port to flakes

This commit is contained in:
Tim Schubert 2021-06-13 13:43:21 +02:00
parent deaa4fb75c
commit 2d9150098e
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
76 changed files with 721 additions and 315 deletions

2
.envrc
View file

@ -1 +1 @@
use nix use flake

15
.github/workflows/nix-flake-check.yml vendored Normal file
View file

@ -0,0 +1,15 @@
name: "nix flake check"
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
with:
install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20210604_8e6ee1b/install
extra_nix_config: |
experimental-features = nix-command flakes
- run: nix flake check

38
.github/workflows/nix-flake-update.yml vendored Normal file
View file

@ -0,0 +1,38 @@
name: "Update flakes"
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: '10 4 * * 0'
jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
with:
install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20210604_8e6ee1b/install
extra_nix_config: |
experimental-features = nix-command flakes
- name: Make changes to pull request
run: nix flake update
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update flakes
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: flake-updates
delete-branch: true
title: 'Update flakes'
body: |
Update report
- Updated with *today's* date
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

View file

@ -1,27 +0,0 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
myPythonPackages = import ./pkgs/python-pkgs;
myPython3Packages = myPythonPackages { callPackage = python3Packages.callPackage; };
in
rec {
lib = import ./lib { inherit pkgs; };
modules = import ./modules;
hmModules = import ./modules/home;
overlays = import ./overlays;
profiles = import ./modules/profiles;
hosts = import ./hosts;
pythonPackages = myPythonPackages;
keys = callPackage ./pkgs/keys { };
homePage = callPackage ./pkgs/homePage { };
deploy = callPackage ./pkgs/deploy.nix { };
recipemd = python3Packages.toPythonApplication myPython3Packages.recipemd;
scripts = callPackage ./pkgs/scripts.nix { };
}

92
flake.lock generated Normal file
View file

@ -0,0 +1,92 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1623875721,
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1624806645,
"narHash": "sha256-f/UWLS34FUlsmL1YhOcpmGhdG808206qiz1MGJd3K1c=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2aeaf65e8f9219c1acdb47bcf278983b3170a344",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1624713701,
"narHash": "sha256-miYoO9/M+ZYlNPknRF9VYh6bQEQCPPz6lM0Pb60jbPk=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "03c60a2db286bcd8ecfac9a8739c50626ca0fd8e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1624447853,
"narHash": "sha256-Zn+vTEa3NE9q6z6ytpcNXrr8jV7HvrKRxMYoD2E6DpE=",
"path": "/nix/store/1iblaav6dxrc5b39b3gbdnbl47sfjxrq-source",
"rev": "1905f5f2e55e0db0bb6244cfe62cb6c0dbda391d",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1624626397,
"narHash": "sha256-+h0ulo5//RqStx6g6MDqD9MzgmBfeZ1VYxwEaSmw/Zs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e1f8852faac7638e88d5e8a5b9ee2a7568685e3f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

12
flake.nix Normal file
View file

@ -0,0 +1,12 @@
{
description = "dadada's nix flake";
inputs = {
flake-utils.url = github:numtide/flake-utils;
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
home-manager.url = github:nix-community/home-manager;
nixos-hardware.url = github:NixOS/nixos-hardware/master;
};
outputs = { ... } @ args: import ./outputs.nix args;
}

42
home/configurations.nix Normal file
View file

@ -0,0 +1,42 @@
{ self
, nixpkgs
, home-manager
}:
let
hmConfiguration =
{ homeDirectory ? "/home/dadada"
, extraModules ? [ ]
, overlays ? [ ]
, system ? "x86_64-linux"
, username ? "dadada"
, stateVersion
}:
(home-manager.lib.homeManagerConfiguration {
configuration = { ... }: {
imports = (nixpkgs.lib.attrValues self.hmModules) ++ extraModules;
nixpkgs = {
config = import ./nixpkgs-config.nix {
pkgs = nixpkgs;
};
overlays = overlays;
};
};
inherit system homeDirectory username stateVersion;
});
in
{
home = hmConfiguration {
extraModules = [ ./home ];
overlays = with self.overlays; [
scripts
];
stateVersion = "20.09";
};
work = hmConfiguration rec {
extraModules = [ ./work ];
homeDirectory = "/home/${username}";
username = "tim.schubert";
stateVersion = "20.09";
};
}

View file

@ -1,6 +1,5 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
this = import ../../.. { inherit pkgs; };
useFeatures = [ useFeatures = [
"alacritty" "alacritty"
"vim" "vim"
@ -9,7 +8,6 @@ let
"gpg" "gpg"
"gtk" "gtk"
"keyring" "keyring"
"ssh"
"sway" "sway"
"syncthing" "syncthing"
"tmux" "tmux"
@ -18,13 +16,16 @@ let
]; ];
in in
{ {
nixpkgs.overlays = [ programs.git = {
this.overlays.dadadaScripts signing = {
this.overlays.python3Packages key = "D68C84695C087E0F733A28D0EEB8D1CE62C4DFEA";
this.overlays.recipemd signByDefault = true;
]; };
userEmail = "dadada@dadada.li";
userName = "dadada";
};
imports = lib.attrValues this.hmModules; programs.gpg.settings.default-key = "99658A3EB5CD7C13";
dadada.home = lib.attrsets.genAttrs useFeatures (useFeatures: { enable = true; }) // { dadada.home = lib.attrsets.genAttrs useFeatures (useFeatures: { enable = true; }) // {
session = { session = {
@ -59,5 +60,5 @@ in
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
home.packages = import ./pkgs.nix { inherit pkgs; }; home.packages = import ./pkgs.nix { pkgs = pkgs; };
} }

View file

@ -1,5 +1,6 @@
{ pkgs }: { pkgs }:
with pkgs; [ with pkgs; [
ag
anki anki
aspell aspell
aspellDicts.de aspellDicts.de
@ -51,6 +52,7 @@ with pkgs; [
mpv mpv
mumble mumble
ncurses ncurses
newsflash
nfs-utils nfs-utils
niv niv
nmap nmap
@ -65,7 +67,6 @@ with pkgs; [
python3 python3
python38Packages.dateutil python38Packages.dateutil
python38Packages.managesieve python38Packages.managesieve
recipemd
ripgrep ripgrep
rustup rustup
signal-desktop signal-desktop

View file

@ -11,7 +11,6 @@ in
programs.direnv = { programs.direnv = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
enableNixDirenvIntegration = true;
}; };
}; };
} }

View file

@ -22,7 +22,6 @@ in
swaylock swaylock
brightnessctl brightnessctl
playerctl playerctl
dadadaScripts
]; ];
wayland.windowManager.sway = { wayland.windowManager.sway = {

7
home/nixpkgs-config.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs }:
{
allowUnfree = true;
allowBroken = false;
android_sdk.accept_license = true;
pulseaudio = true;
}

View file

@ -1,10 +1,5 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let
this = import ../../.. { inherit pkgs; };
in
{ {
imports = lib.attrValues this.hmModules;
dadada.home = { dadada.home = {
vim.enable = true; vim.enable = true;
direnv.enable = true; direnv.enable = true;

View file

@ -6,7 +6,6 @@ with pkgs; [
element-desktop element-desktop
evince evince
file file
firefox-bin
fzf fzf
git-lfs git-lfs
gitAndTools.hub gitAndTools.hub

View file

@ -1,6 +0,0 @@
{
ifrit = ./ifrit;
gorgon = ./gorgon;
surgat = ./surgat;
pruflas = ./pruflas;
}

View file

@ -1,15 +0,0 @@
{
admin = ./admin.nix;
backup = ./backup.nix;
homePage = ./homepage.nix;
element = ./element.nix;
fido2 = ./fido2.nix;
fileShare = ./fileShare.nix;
gitea = ./gitea.nix;
networking = ./networking.nix;
share = ./share.nix;
steam = ./steam.nix;
autoUpgrade = ./update.nix;
vpnServer = ./vpnServer.nix;
weechat = ./weechat.nix;
}

View file

@ -1,15 +0,0 @@
[
./admin.nix
./backup.nix
./element.nix
./fido2.nix
./fileShare.nix
./gitea.nix
./homepage.nix
./networking.nix
./share.nix
./steam.nix
./update.nix
./vpnServer.nix
./weechat.nix
]

View file

@ -1,4 +0,0 @@
{
base = ./base;
laptop = ./laptop;
}

View file

@ -1,45 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
{
#nixpkgs.overlays = attrValues (import ../../../overlays);
# conflicts with power-management
services.tlp.enable = false;
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.domain = mkDefault "dadada.li";
dadada = {
networking = {
useLocalResolver = mkDefault true;
};
autoUpgrade.enable = true;
};
services.fwupd.enable = true;
fonts.fonts = mkDefault (with pkgs; [
source-code-pro
]);
time.timeZone = mkDefault "Europe/Berlin";
i18n.defaultLocale = mkDefault "en_US.UTF-8";
console.keyMap = mkDefault "us";
users.mutableUsers = true;
programs.zsh = mkDefault {
enable = true;
autosuggestions.enable = true;
enableCompletion = true;
histSize = 100000;
vteIntegration = true;
syntaxHighlighting = {
enable = true;
highlighters = [ "main" "brackets" "pattern" "root" "line" ];
};
};
}

69
nixos/configurations.nix Normal file
View file

@ -0,0 +1,69 @@
{ self
, nixpkgs
, nixosSystem
, home-manager
, nixos-hardware
}:
let adapterModule = {
imports = [ ./modules ];
nix.nixPath = [
"home-manager=${home-manager}"
"nixpkgs=${nixpkgs}"
"dadada=${self}"
];
nix.registry = {
home-manager.flake = home-manager;
nixpkgs.flake = nixpkgs;
dadada.flake = self;
};
nix.binaryCachePublicKeys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"gorgon:eEE/PToceRh34UnnoFENERhk89dGw5yXOpJ2CUbfL/Q="
];
nix.requireSignedBinaryCaches = true;
nix.useSandbox = true;
nixpkgs.overlays = (nixpkgs.lib.attrValues self.overlays);
};
in
{
gorgon = nixosSystem {
system = "x86_64-linux";
modules = [
adapterModule
nixos-hardware.nixosModules.lenovo-thinkpad-t14s-amd-gen1
#home-manager.nixosModules.home-manager
#{
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
# home-manager.users.dadada = self.hmConfigurations.home;
#}
./modules/profiles/laptop.nix
./gorgon/configuration.nix
];
};
ifrit = nixosSystem {
system = "x86_64-linux";
modules = [
adapterModule
./modules/profiles/server.nix
./ifrit/configuration.nix
];
};
surgat = nixosSystem {
system = "x86_64-linux";
modules = [
adapterModule
./modules/profiles/server.nix
./surgat/configuration.nix
];
};
pruflas = nixosSystem {
system = "x86_64-linux";
modules = [
adapterModule
./modules/profiles/server.nix
./pruflas/configuration.nix
];
};
}

View file

@ -1,35 +1,38 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
this = import ../.. { inherit pkgs; }; signHook = pkgs.writeShellScript "/etc/nix/sign-cache.sh"
nixos-hardware = builtins.fetchTarball { ''
url = "https://github.com/NixOS/nixos-hardware/archive/c242378e63b0ec334e964ac0c0fbbdd2b3e89ebf.tar.gz"; set -eu
sha256 = "1z4cr5gsyfdpcy31vqg4ikalbxmnnac6jjk1nl8mxj0h0ix7pp36"; set -f # disable globbing
}; export IFS=' '
echo "Signing paths" $OUT_PATHS
nix store sign --key-file /etc/nix/key.private $OUT_PATHS
'';
in in
{ {
imports = (lib.attrValues this.modules) ++ [ imports = [
../../modules/profiles/laptop ./hardware-configuration.nix
"${nixos-hardware}/lenovo/thinkpad/t14s"
]; ];
nix.package = pkgs.nixUnstable; nix.package = pkgs.nixUnstable;
nix.extraOptions = '' nix.extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
post-build-hook = ${signHook}
''; '';
# conflicts with power-management
services.tlp.enable = false;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
virtualisation = {
libvirtd.enable = true;
docker.enable = true;
};
virtualisation.docker.extraOptions = "--bip=192.168.1.5/24";
networking.hostName = "gorgon"; networking.hostName = "gorgon";
dadada = { dadada = {
admin.enable = false; autoUpgrade.enable = false;
headphones.enable = true;
steam.enable = true; steam.enable = true;
#fido2 = { #fido2 = {
# credential = "04ea2813a116f634e90f9728dbbb45f1c0f93b7811941a5a14fb75e711794df0c26552dae2262619c1da2be7562ec9dd94888c71a9326fea70dfe16214b5ea8ec01473070000"; # credential = "04ea2813a116f634e90f9728dbbb45f1c0f93b7811941a5a14fb75e711794df0c26552dae2262619c1da2be7562ec9dd94888c71a9326fea70dfe16214b5ea8ec01473070000";
@ -38,6 +41,7 @@ in
luks.uuid = "3d0e5b93-90ca-412a-b4e0-3e6bfa47d3f4"; luks.uuid = "3d0e5b93-90ca-412a-b4e0-3e6bfa47d3f4";
networking = { networking = {
enableBsShare = true; enableBsShare = true;
useLocalResolver = true;
vpnExtension = "3"; vpnExtension = "3";
}; };
backupClient = { backupClient = {
@ -51,14 +55,8 @@ in
"vm.swappiness" = 90; "vm.swappiness" = 90;
}; };
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
programs.adb.enable = true; programs.adb.enable = true;
services.fstrim.enable = true;
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing = { services.printing = {
enable = true; enable = true;
@ -71,23 +69,17 @@ in
]; ];
}; };
environment.systemPackages = [ pkgs.ghostscript ]; services.miniflux = {
enable = true;
hardware = { config = {
bluetooth.enable = true; CLEANUP_FREQUENCY = "48";
pulseaudio = { LISTEN_ADDR = "localhost:8080";
enable = true;
extraModules = [ pkgs.pulseaudio-modules-bt ];
extraConfig = ''
set-source-volume 1 10000
'';
package = pkgs.pulseaudioFull;
}; };
adminCredentialsFile = "/var/lib/miniflux/admin-credentials";
}; };
services.avahi.enable = false; environment.systemPackages = [ pkgs.ghostscript ];
networking.networkmanager.enable = true;
networking.firewall = { networking.firewall = {
enable = true; enable = true;
allowedTCPPorts = [ allowedTCPPorts = [
@ -98,25 +90,6 @@ in
]; ];
}; };
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
programs.sway = {
enable = true;
wrapperFeatures.gtk = true; # so that gtk works properly
extraPackages = with pkgs; [
swaylock
swayidle
wl-clipboard
mako # notification daemon
alacritty # Alacritty is the default terminal in the config
dmenu # Dmenu is the default in the config but i recommend wofi since its wayland native
];
};
xdg.mime.enable = true;
users.users = { users.users = {
dadada = { dadada = {
isNormalUser = true; isNormalUser = true;

View file

@ -0,0 +1,42 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/2478e089-e5d6-480c-8530-4ea46988f9f7";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5B90-D460";
fsType = "vfat";
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/a617625e-9325-4612-a086-954fb4b99ee0";
fsType = "ext4";
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/1f6ab0fb-ef4d-45b1-a731-ad0e7a440eef";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/92310a00-7f69-4775-85cb-38e1790f71db"; }
];
nix.maxJobs = lib.mkDefault 16;
}

View file

@ -10,7 +10,7 @@ let
in in
{ {
imports = [ imports = [
../../modules/profiles/base ./hardware-configuration.nix
]; ];
dadada = { dadada = {

View file

@ -0,0 +1,26 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix" )
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "ehci_pci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/0b4f5f01-5849-4f05-9822-b648abbc2485";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/53b5715e-2724-4800-9cfc-f892115681b6"; }
];
nix.maxJobs = lib.mkDefault 2;
}

View file

@ -5,24 +5,26 @@ let
cfg = config.dadada.admin; cfg = config.dadada.admin;
in in
{ {
options.dadada.admin = { options = {
enable = mkEnableOption "Enable admin access"; dadada.admin = {
enable = mkEnableOption "Enable admin access";
users = mkOption { users = mkOption {
type = with types; attrsOf (listOf path); type = with types; attrsOf (listOf path);
default = [ ]; default = [ ];
description = '' description = ''
List of admin users with root access to all the machine. List of admin users with root access to all the machine.
''; '';
example = literalExample "\"user1\" = [ /path/to/key1 /path/to/key2 ]"; example = literalExample "\"user1\" = [ /path/to/key1 /path/to/key2 ]";
}; };
rat = mkOption { rat = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
Enable NAT and firewall traversal for SSH via tor hidden service Enable NAT and firewall traversal for SSH via tor hidden service
''; '';
};
}; };
}; };
@ -49,7 +51,7 @@ in
tmux tmux
]; ];
services.tor.hiddenServices = { services.tor.relay.onionServices = {
"rat" = mkIf cfg.rat.enable { "rat" = mkIf cfg.rat.enable {
name = "rat"; name = "rat";
map = [{ port = 22; }]; map = [{ port = 22; }];

View file

@ -21,12 +21,14 @@ let
]; ];
cfg = config.dadada.backupClient; cfg = config.dadada.backupClient;
in in
{ {
options.dadada.backupClient = { options = {
enable = mkEnableOption "Enable backup client"; dadada.backupClient = {
gs = mkEnableOption "Enable backup to GS location"; enable = mkEnableOption "Enable backup client";
bs = mkEnableOption "Enable backup to BS location"; gs = mkEnableOption "Enable backup to GS location";
}; bs = mkEnableOption "Enable backup to BS location";
};
};
config = mkIf cfg.enable { config = mkIf cfg.enable {

19
nixos/modules/default.nix Normal file
View file

@ -0,0 +1,19 @@
{ ... }:
{
imports = [
./admin.nix
./backup.nix
./element.nix
./fido2.nix
./fileShare.nix
./gitea.nix
./headphones.nix
./homepage.nix
./networking.nix
./share.nix
./steam.nix
./update.nix
./vpnServer.nix
./weechat.nix
];
}

View file

@ -5,7 +5,6 @@ let
fido2 = config.dadada.fido2; fido2 = config.dadada.fido2;
in in
{ {
options = { options = {
dadada.luks = { dadada.luks = {
uuid = mkOption { uuid = mkOption {

View file

@ -0,0 +1,25 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.dadada.headphones;
in
{
options = {
dadada.headphones = {
enable = mkEnableOption "Enable bluetooth headphones with more audio codecs.";
};
};
config = mkIf cfg.enable {
hardware = {
bluetooth.enable = true;
pulseaudio = {
enable = true;
extraModules = [ pkgs.pulseaudio-modules-bt ];
extraConfig = ''
set-source-volume 1 10000
'';
package = pkgs.pulseaudioFull;
};
};
};
}

View file

@ -12,7 +12,7 @@ with lib; {
services.nginx.virtualHosts."dadada.li" = { services.nginx.virtualHosts."dadada.li" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
root = /var/lib/www/dadada.li; root = "/var/lib/www/dadada.li";
}; };
}; };
} }

View file

@ -4,19 +4,21 @@ let
cfg = config.dadada.networking; cfg = config.dadada.networking;
in in
{ {
options.dadada.networking = { options = {
useLocalResolver = mkEnableOption "Enable local caching name server"; dadada.networking = {
wanInterfaces = mkOption { useLocalResolver = mkEnableOption "Enable local caching name server";
type = with types; listOf str; wanInterfaces = mkOption {
description = "WAN network interfaces"; type = with types; listOf str;
default = [ ]; description = "WAN network interfaces";
default = [ ];
};
vpnExtension = mkOption {
type = with types; nullOr str;
description = "Last part of VPN address";
default = null;
};
enableBsShare = mkEnableOption "Enable network share at BS location";
}; };
vpnExtension = mkOption {
type = with types; nullOr str;
description = "Last part of VPN address";
default = null;
};
enableBsShare = mkEnableOption "Enable network share at BS location";
}; };
config = { config = {
@ -75,7 +77,7 @@ in
partOf = [ "wg-reresolve-dns.service" ]; partOf = [ "wg-reresolve-dns.service" ];
timerConfig.OnCalendar = "hourly"; timerConfig.OnCalendar = "hourly";
}; };
systemd.services.wg-reresolve-dns = mkIf (cfg.vpnExtension != null) { systemd.services.wg-reresolve-dns = mkIf (cfg.vpnExtension != null) {
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
script = '' script = ''
${pkgs.wireguard-tools}/bin/wg set bs peer lFB2DWtzp55ajV0Fk/OWdO9JlGvN9QsayYKQQHV3GEs= endpoint bs.vpn.dadada.li:51234 persistent-keepalive 25 allowed-ips fd42:dead:beef::/48 ${pkgs.wireguard-tools}/bin/wg set bs peer lFB2DWtzp55ajV0Fk/OWdO9JlGvN9QsayYKQQHV3GEs= endpoint bs.vpn.dadada.li:51234 persistent-keepalive 25 allowed-ips fd42:dead:beef::/48

View file

@ -0,0 +1,55 @@
{ config, pkgs, lib, ... }:
with lib;
{
networking.domain = mkDefault "dadada.li";
services.fwupd.enable = mkDefault true;
fonts.fonts = mkDefault (with pkgs; [
source-code-pro
]);
time.timeZone = mkDefault "Europe/Berlin";
i18n.defaultLocale = mkDefault "en_US.UTF-8";
console.keyMap = mkDefault "us";
users.mutableUsers = mkDefault true;
programs.zsh = mkDefault {
enable = true;
autosuggestions.enable = true;
enableCompletion = true;
histSize = 100000;
vteIntegration = true;
syntaxHighlighting = {
enable = true;
highlighters = [ "main" "brackets" "pattern" "root" "line" ];
};
};
virtualisation = {
libvirtd.enable = mkDefault true;
docker.enable = mkDefault true;
};
virtualisation.docker.extraOptions = mkDefault "--bip=192.168.1.5/24";
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = mkDefault true;
boot.loader.efi.canTouchEfiVariables = mkDefault true;
services.fstrim.enable = mkDefault true;
services.avahi.enable = false;
networking.networkmanager.enable = mkDefault true;
networking.firewall.enable = mkDefault true;
services.xserver.enable = mkDefault true;
services.xserver.displayManager.gdm.enable = mkDefault true;
services.xserver.desktopManager.gnome.enable = mkDefault true;
xdg.mime.enable = mkDefault true;
}

View file

@ -1,23 +1,13 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib; with lib;
{ {
nix.binaryCachePublicKeys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"gorgon:eEE/PToceRh34UnnoFENERhk89dGw5yXOpJ2CUbfL/Q="
];
nixpkgs.overlays = attrValues (import ../../../overlays);
imports = import ../../module-list.nix;
networking.domain = mkDefault "dadada.li"; networking.domain = mkDefault "dadada.li";
dadada.admin.users = { dadada.admin.users = {
"dadada" = [ "${pkgs.dadadaKeys}/dadada.pub" ]; "dadada" = [ "${pkgs.keys}/dadada.pub" ];
}; };
dadada.autoUpgrade.enable = mkDefault true; dadada.autoUpgrade.enable = mkDefault false;
environment.noXlibs = mkDefault true; environment.noXlibs = mkDefault true;
documentation.enable = mkDefault false; documentation.enable = mkDefault false;
@ -28,5 +18,4 @@ with lib;
font = "Lat2-Terminus16"; font = "Lat2-Terminus16";
keyMap = "us"; keyMap = "us";
}; };
} }

View file

@ -4,8 +4,10 @@ let
cfg = config.dadada.steam; cfg = config.dadada.steam;
in in
{ {
options.dadada.steam = { options = {
enable = mkEnableOption "Enable Steam config"; dadada.steam = {
enable = mkEnableOption "Enable Steam config";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;

View file

@ -11,7 +11,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
nix = { nix = {
autoOptimiseStore = true; autoOptimiseStore = false;
useSandbox = true; useSandbox = true;
gc = { gc = {
automatic = true; automatic = true;

14
nixos/modules/zsh.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, pkgs, lib, ... }:
{
programs.zsh = {
enable = true;
autosuggestions.enable = true;
enableCompletion = true;
histSize = 100000;
vteIntegration = true;
syntaxHighlighting = {
enable = true;
highlighters = [ "main" "brackets" "pattern" "root" "line" ];
};
};
}

View file

@ -2,28 +2,9 @@
with lib; with lib;
let let
hostName = "pruflas"; hostName = "pruflas";
this = import ../.. { inherit pkgs; };
logo = builtins.fetchurl {
sha256 = "1c8y19a3yz4g9dl7hbx7aq4y92jfxl4nrsparzyzwn0wcm9jan27";
url = "https://openmoji.org/php/download_from_github.php?emoji_hexcode=1F431-200D-1F4BB&emoji_variant=color";
name = "open-moji-hack-cat";
};
in in
{ {
nix.binaryCachePublicKeys = [ imports = [ ./hardware-configuration.nix ];
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"gorgon:eEE/PToceRh34UnnoFENERhk89dGw5yXOpJ2CUbfL/Q="
];
imports = [ this.profiles.base ];
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
networking.hostName = hostName; networking.hostName = hostName;
networking.hosts = { networking.hosts = {
@ -41,7 +22,6 @@ in
useSubstitutes = true; useSubstitutes = true;
listenHost = "hydra.dadada.li"; listenHost = "hydra.dadada.li";
port = 3000; port = 3000;
logo = logo;
}; };
nix.buildMachines = [ nix.buildMachines = [
@ -63,12 +43,7 @@ in
''; '';
}; };
dadada.admin = { dadada.admin.enable = true;
enable = true;
users = {
"dadada" = [ "${pkgs.dadadaKeys}/dadada.pub" ];
};
};
dadada.networking.vpnExtension = "5"; dadada.networking.vpnExtension = "5";
dadada.backupClient = { dadada.backupClient = {

View file

@ -0,0 +1,34 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/6d7ea470-1909-4e84-82a6-d5d5e9eecf78";
fsType = "ext4";
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/337f04a7-4fe9-49a2-8a58-07dd4bc85168";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/0494-CB52";
fsType = "vfat";
};
swapDevices = [ ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

View file

@ -1,10 +1,11 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
hostName = "surgat"; hostName = "surgat";
this = import ../.. { inherit pkgs; };
in in
{ {
imports = [ this.profiles.base ]; imports = [
./hardware-configuration.nix
];
networking.hostName = hostName; networking.hostName = hostName;
@ -37,7 +38,7 @@ in
dadada.admin = { dadada.admin = {
enable = true; enable = true;
users = { users = {
"dadada" = [ "${pkgs.dadadaKeys}/dadada.pub" ]; "dadada" = [ "${pkgs.keys}/dadada.pub" ];
}; };
}; };

View file

@ -0,0 +1,30 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "xhci_pci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/bd0b4d2d-37e5-444b-82ba-d7629114bf11";
fsType = "ext4";
};
boot.initrd.luks.devices."surgat".device = "/dev/disk/by-uuid/5aa2b4d3-5711-451c-bd35-7c33b5019093";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/472bc34f-3803-44ee-ad2a-f0080c0a44d3";
fsType = "ext2";
};
swapDevices = [ ];
}

73
outputs.nix Normal file
View file

@ -0,0 +1,73 @@
# Adapted from Mic92/dotfiles
{ self
, flake-utils
, nixpkgs
, home-manager
, nixos-hardware
, ...
}:
(flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
selfPkgs = self.packages.${system};
pythonPackages = import ./pkgs/python-pkgs;
python3Packages = pythonPackages { callPackage = pkgs.python3Packages.callPackage; };
#lib = import ./lib;
in
{
apps.deploy = {
type = "app";
program = "${selfPkgs.deploy}/bin/deploy";
};
apps.hm-switch = {
type = "app";
program = toString (pkgs.writeScript "hm-switch" ''
#!${pkgs.runtimeShell}
set -eu -o pipefail -x
tmpdir=$(mktemp -d)
export PATH=${pkgs.lib.makeBinPath [ pkgs.coreutils pkgs.nixFlakes pkgs.jq ]}
trap "rm -rf $tmpdir" EXIT
declare -A profiles=(["gorgon"]="home" ["timsch-nb"]="work")
profile=''${profiles[$HOSTNAME]:-common}
flake=$(nix flake metadata --json ${./.} | jq -r .url)
nix build --show-trace --out-link "$tmpdir/result" "$flake#hmConfigurations.''${profile}.activationPackage" "$@"
link=$(realpath $tmpdir/result)
$link/activate
'');
};
apps.recipemd = {
type = "app";
program = "${selfPkgs.recipemd}/bin/recipemd";
};
devShell = pkgs.callPackage ./shell.nix {
deploy = selfPkgs.deploy;
};
packages = flake-utils.lib.flattenTree {
deploy = pkgs.callPackage ./pkgs/deploy.nix { };
scripts = pkgs.callPackage ./pkgs/scripts.nix { };
keys = pkgs.callPackage ./pkgs/keys { };
homePage = pkgs.callPackage ./pkgs/homePage { };
recipemd = pkgs.python3Packages.toPythonApplication python3Packages.recipemd;
};
})) // {
hmConfigurations = import ./home/configurations.nix {
inherit self nixpkgs home-manager;
};
hmModules = import ./home/modules;
nixosConfigurations = import ./nixos/configurations.nix {
nixosSystem = nixpkgs.lib.nixosSystem;
inherit self nixpkgs home-manager nixos-hardware;
};
nixosModule = import ./nixos/modules;
overlays = import ./overlays;
pythonPackages = import ./pkgs/python-pkgs;
hydraJobs = (
nixpkgs.lib.mapAttrs'
(name: config: nixpkgs.lib.nameValuePair name config.config.system.build.toplevel)
self.nixosConfigurations
) // (nixpkgs.lib.mapAttrs'
(name: config: nixpkgs.lib.nameValuePair name config.activation-script)
self.hmConfigurations
);
}

View file

@ -1,18 +0,0 @@
self: super:
let
isReserved = n: builtins.elem n [
"lib"
"hosts"
"hmModules"
"modules"
"overlays"
"profiles"
"pythonPackages"
];
nameValuePair = n: v: { name = n; value = v; };
attrs = import ./default.nix { pkgs = super; };
in
builtins.listToAttrs
(map (n: nameValuePair n attrs.${n})
(builtins.filter (n: !isReserved n)
(builtins.attrNames attrs)))

View file

@ -1,16 +1,18 @@
{ let
tubslatex = import ./tubslatex.nix;
dadadaKeys = self: super: {
dadadaKeys = super.callPackage ../pkgs/keys { };
};
homePage = self: super: {
homePage = super.callPackage ../pkgs/homePage { };
};
dadadaScripts = self: super: {
dadadaScripts = super.callPackage ../pkgs/scripts.nix { };
};
python3Packages = import ./python3-packages.nix; python3Packages = import ./python3-packages.nix;
recipemd = self: super: { in
recipemd = super.python3Packages.toPythonApplication super.python3Packages.recipemd; {
#tubslatex = import ./tubslatex.nix;
keys = final: prev: {
keys = prev.callPackage ../pkgs/keys { };
};
homePage = final: prev: {
homePage = prev.callPackage ../pkgs/homePage { };
};
scripts = final: prev: {
scipts = prev.callPackage ../pkgs/scripts.nix { };
};
recipemd = final: prev: {
recipemd = prev.python3Packages.toPythonApplication prev.python3Packages.recipemd;
}; };
} }

View file

@ -6,7 +6,7 @@
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "dadada-deploy"; name = "dadada-deploy";
version = "0.1"; version = "0.1.1";
src = ../utils; src = ../utils;
@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
description = "deploy scripts"; description = "deploy scripts";
license = licenses.publicDomain; license = licenses.publicDomain;
platforms = platforms.linux; platforms = platforms.unix;
maintainers = [ "dadada" ]; maintainers = [ "dadada" ];
}; };
} }

View file

@ -15,5 +15,5 @@ stdenv.mkDerivation rec {
cp -r src/* $out/ cp -r src/* $out/
''; '';
name = "dadada.li"; name = "dadada.li";
version = "0.1"; version = "0.2";
} }

View file

@ -1,6 +1,6 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchFromGitHub
, pytestCheckHook , pytestCheckHook
, pythonPackages , pythonPackages
, installShellFiles , installShellFiles
@ -14,10 +14,11 @@ buildPythonPackage rec {
disabled = isPy36 || isPy27; disabled = isPy36 || isPy27;
src = fetchPypi { src = fetchFromGitHub {
pname = pname; owner = "tstehr";
version = version; repo = "recipemd";
sha256 = "142w5zb2gf8s5z72bflpkmks633ic42z97nsgw491mskl6jg7cvq"; rev = "v4.0.7";
sha256 = "sha256-P65CxTaROfvx9kNSJWa5CiCUHCurTMZx8uUH9W9uK1U=";
}; };
propagatedBuildInputs = with pythonPackages; [ propagatedBuildInputs = with pythonPackages; [
@ -47,7 +48,7 @@ buildPythonPackage rec {
pythonPackages.pytestcov pythonPackages.pytestcov
]; ];
doCheck = false; doCheck = true;
meta = with lib; { meta = with lib; {
description = "Markdown recipe manager, reference implementation of RecipeMD"; description = "Markdown recipe manager, reference implementation of RecipeMD";

View file

@ -3,7 +3,7 @@
(import (import
(pkgs.fetchgit { (pkgs.fetchgit {
url = "https://git.dadada.li/dadada/scripts.git"; url = "https://git.dadada.li/dadada/scripts.git";
sha256 = "0pspybphfqmccl9w97dr89g47dbxk8ly05x8x7c313a5i3pzd5lm"; sha256 = "sha256-Kdwb34XXLOl4AaiVmOZ3nlu/KdENMqvH+UwISv8Pyiw=";
rev = "e1a887a658da130c2a513d4c770d5026565c4e69"; rev = "065ff0f0ee9e44234678f0fefbba7961ea42518c";
}) })
{ stdenv = stdenv; lib = lib; }) { stdenv = stdenv; lib = lib; })

View file

@ -1,7 +1,8 @@
{ pkgs ? import <nixpkgs> { } }: { mkShell
, deploy
}:
with (import ./default.nix { inherit pkgs; }); mkShell {
pkgs.mkShell {
buildInputs = [ buildInputs = [
deploy deploy
]; ];