This commit is contained in:
Lukas Wurzinger 2023-09-29 20:39:08 +02:00
parent ad9bd080eb
commit 8efb72f9d3
62 changed files with 118 additions and 81 deletions

View file

@ -6,19 +6,22 @@
... ...
}: { }: {
imports = [ imports = [
"${inputs.impermanence}/nixos.nix"
./features/avahi.nix ./features/avahi.nix
./features/bluetooth.nix ./features/bluetooth.nix
./features/command-not-found.nix ./features/command-not-found.nix
./features/flatpak.nix
./features/fonts.nix ./features/fonts.nix
./features/fwupd.nix ./features/fwupd.nix
./features/geoclue.nix ./features/geoclue.nix
./features/mullvad.nix
./features/opengl.nix ./features/opengl.nix
./features/openssh.nix ./features/openssh.nix
./features/opentabletdriver.nix
./features/pipewire.nix ./features/pipewire.nix
./features/plasma.nix ./features/plasma.nix
./features/printing.nix
./features/sops.nix ./features/sops.nix
./features/steam.nix
./features/sudo.nix ./features/sudo.nix
./features/users.nix ./features/users.nix
]; ];

View file

@ -0,0 +1,3 @@
{
services.mullvad-vpn.enable = true;
}

View file

@ -6,8 +6,6 @@
... ...
}: { }: {
imports = [ imports = [
(inputs.impermanence + "/nixos.nix")
./features/avahi.nix ./features/avahi.nix
./features/command-not-found.nix ./features/command-not-found.nix
./features/openssh.nix ./features/openssh.nix

View file

@ -45,7 +45,7 @@
sops sops
systeroid systeroid
tokei tokei
vscodium vscodium-fhs
]; ];
xdg = { xdg = {

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1694710316, "lastModified": 1695887975,
"narHash": "sha256-uRh46iIC86D8BD1wCDA5gRrt+hslUXiD0kx/UjnjBcs=", "narHash": "sha256-u3+5FR12dI305jCMb0fJNQx2qwoQ54lv1tPoEWp0hmg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "570256327eb6ca6f7bebe8d93af49459092a0c43", "rev": "adcfd6aa860d1d129055039696bc457af7d50d0e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -22,11 +22,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1694643239, "lastModified": 1695738267,
"narHash": "sha256-pv2k/5FvyirDE8g4TNehzwZ0T4UOMMmqWSQnM/luRtE=", "narHash": "sha256-LTNAbTQ96xSj17xBfsFrFS9i56U2BMLpD0BduhrsVkU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "d9b88b43524db1591fb3d9410a21428198d75d49", "rev": "0f4e5b4999fd6a42ece5da8a3a2439a50e48e486",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -52,11 +52,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1694767346, "lastModified": 1695830400,
"narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=", "narHash": "sha256-gToZXQVr0G/1WriO83olnqrLSHF2Jb8BPcmCt497ro0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ace5093e36ab1e95cb9463863491bee90d5a4183", "rev": "8a86b98f0ba1c405358f1b71ff8b5e1d317f5db2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -68,11 +68,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1693675694, "lastModified": 1694908564,
"narHash": "sha256-2pIOyQwGyy2FtFAUIb8YeKVmOCcPOTVphbAvmshudLE=", "narHash": "sha256-ducA98AuWWJu5oUElIzN24Q22WlO8bOfixGzBgzYdVc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5601118d39ca9105f8e7b39d4c221d3388c0419d", "rev": "596611941a74be176b98aeba9328aa9d01b8b322",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -84,11 +84,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1693626178, "lastModified": 1694760568,
"narHash": "sha256-Rpiy6lIOu4zny8tfGuIeN1ji9eSz9nPmm9yBhh/4IOM=", "narHash": "sha256-3G07BiXrp2YQKxdcdms22MUx6spc6A++MSePtatCYuI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "bfb7dfec93f3b5d7274db109f2990bc889861caf", "rev": "46688f8eb5cd6f1298d873d4d2b9cf245e09e88e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -113,11 +113,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1694495315, "lastModified": 1695284550,
"narHash": "sha256-sZEYXs9T1NVHZSSbMqBEtEm2PGa7dEDcx0ttQkArORc=", "narHash": "sha256-z9fz/wz9qo9XePEvdduf+sBNeoI9QG8NJKl5ssA8Xl4=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "ea208e55f8742fdcc0986b256bdfa8986f5e4415", "rev": "2f375ed8702b0d8ee2430885059d5e7975e38f78",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -20,6 +20,7 @@
self, self,
nixpkgs, nixpkgs,
home-manager, home-manager,
impermanence,
sops-nix, sops-nix,
... ...
} @ inputs: let } @ inputs: let
@ -34,11 +35,14 @@
pkgs = import nixpkgs {inherit system;}; pkgs = import nixpkgs {inherit system;};
}); });
mkSystem = class: name: args @ {modules ? [], ...}: mkSystem = name: {
class,
modules ? [],
...
}:
nixpkgs.lib.nixosSystem ({ nixpkgs.lib.nixosSystem ({
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs;};
} }
// args
// { // {
modules = modules =
modules modules
@ -51,7 +55,7 @@
nix = { nix = {
registry = lib.mapAttrs (_: value: {flake = value;}) inputs; registry = lib.mapAttrs (_: value: {flake = value;}) inputs;
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry;
settings = { settings = {
experimental-features = "nix-command flakes"; experimental-features = "nix-command flakes";
@ -63,51 +67,64 @@
networking.hostName = lib.mkDefault name; networking.hostName = lib.mkDefault name;
}) })
(./common/nixos + "/${class}.nix") (./system + "/${name}")
(./nixos + "/${name}") ({lib, ...}: {
home-manager.nixosModules.home-manager
{
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
extraSpecialArgs = {inherit inputs;}; extraSpecialArgs = {inherit inputs;};
users.lukas.imports = [
users = lib.mapAttrs (username: user:
user
// {
imports =
user.imports
++ [
({config, ...}: { ({config, ...}: {
home.homeDirectory = home = {
nixpkgs.lib.mkDefault "/home/${config.home.username}"; username = lib.mkDefault username;
homeDirectory = lib.mkDefault "/home/${config.home.username}";
};
systemd.user.startServices = "sd-switch"; systemd.user.startServices = "sd-switch";
}) })
(./common/home-manager + "/${class}.nix") (./common/user + "/${class}.nix")
(./home-manager + "/${name}/lukas.nix")
]; ];
})
(import (./user + "/${name}"));
}; };
} })
(./common/system + "/${class}.nix")
home-manager.nixosModules.home-manager
(impermanence + "/nixos.nix")
(sops-nix + "/modules/sops") (sops-nix + "/modules/sops")
]; ];
}); });
setups = { systems = {
desktop = { glacier = {
glacier = {}; class = "desktop";
flamingo = {};
scenery = {};
}; };
server = { flamingo = {
abacus = {}; class = "desktop";
};
vessel = {}; scenery = {
class = "desktop";
};
abacus = {
class = "server";
};
vessel = {
class = "server";
}; };
}; };
in { in {
formatter = forEachSystem ({pkgs}: pkgs.alejandra); formatter = forEachSystem ({pkgs}: pkgs.alejandra);
nixosConfigurations = nixosConfigurations = nixpkgs.lib.mapAttrs mkSystem systems;
nixpkgs.lib.attrsets.mergeAttrsList
(builtins.attrValues (nixpkgs.lib.mapAttrs
(class: configs: (nixpkgs.lib.mapAttrs (mkSystem class) configs))
setups));
}; };
} }

View file

@ -52,7 +52,7 @@ in {
StateDirectoryMode = "0700"; StateDirectoryMode = "0700";
UMask = "0077"; UMask = "0077";
WorkingDirectory = "/var/lib/hiraeth"; WorkingDirectory = "/var/lib/hiraeth";
ExecStart = "${hiraeth}/bin/hiraeth run"; ExecStart = "${pkgs.getExe' hiraeth "hiraeth"} run";
Restart = "on-failure"; Restart = "on-failure";
TimeoutSec = 15; TimeoutSec = 15;
ReadOnlyPaths = "/etc/hiraeth/hiraeth.toml"; ReadOnlyPaths = "/etc/hiraeth/hiraeth.toml";

View file

@ -11,8 +11,6 @@
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
inputs.hardware.nixosModules.lenovo-thinkpad-t480 inputs.hardware.nixosModules.lenovo-thinkpad-t480
../features/flatpak.nix
]; ];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
@ -22,8 +20,6 @@
kernelModules = ["kvm-intel"]; kernelModules = ["kvm-intel"];
}; };
hardware.cpu.intel.updateMicrocode = config.hardware.enableRedistributableFirmware;
system.stateVersion = "23.11"; system.stateVersion = "23.11";
powerManagement.cpuFreqGovernor = "powersave"; powerManagement.cpuFreqGovernor = "powersave";

View file

@ -11,11 +11,6 @@
inputs.hardware.nixosModules.common-cpu-amd inputs.hardware.nixosModules.common-cpu-amd
inputs.hardware.nixosModules.common-gpu-amd inputs.hardware.nixosModules.common-gpu-amd
inputs.hardware.nixosModules.common-pc-ssd inputs.hardware.nixosModules.common-pc-ssd
../features/flatpak.nix
../features/opentabletdriver.nix
../features/printing.nix
../features/steam.nix
]; ];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
@ -30,8 +25,6 @@
binfmt.emulatedSystems = ["aarch64-linux"]; binfmt.emulatedSystems = ["aarch64-linux"];
}; };
hardware.cpu.amd.updateMicrocode = config.hardware.enableRedistributableFirmware;
system.stateVersion = "23.11"; system.stateVersion = "23.11";
powerManagement.cpuFreqGovernor = "performance"; powerManagement.cpuFreqGovernor = "performance";
@ -40,6 +33,4 @@
epson-escpr epson-escpr
epson-escpr2 epson-escpr2
]; ];
services.mullvad-vpn.enable = true;
} }

View file

@ -18,8 +18,6 @@
kernelModules = ["kvm-intel"]; kernelModules = ["kvm-intel"];
}; };
hardware.cpu.intel.updateMicrocode = config.hardware.enableRedistributableFirmware;
system.stateVersion = "23.11"; system.stateVersion = "23.11";
powerManagement.cpuFreqGovernor = "powersave"; powerManagement.cpuFreqGovernor = "powersave";

View file

@ -1,4 +1,8 @@
{pkgs, ...}: { {
pkgs,
lib,
...
}: {
systemd.timers.local-backup = { systemd.timers.local-backup = {
description = "Local rsync Backup"; description = "Local rsync Backup";
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];
@ -13,7 +17,7 @@
description = "Local rsync Backup"; description = "Local rsync Backup";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = ''${pkgs.rsync}/bin/rsync --verbose --verbose --archive --update --delete /srv/storage/ /srv/backup/''; ExecStart = ''${lib.getExe pkgs.rsync} --verbose --verbose --archive --update --delete /srv/storage/ /srv/backup/'';
User = "root"; User = "root";
Group = "root"; Group = "root";
}; };

View file

@ -24,8 +24,6 @@
kernelModules = ["kvm-intel"]; kernelModules = ["kvm-intel"];
}; };
hardware.cpu.intel.updateMicrocode = config.hardware.enableRedistributableFirmware;
system.stateVersion = "23.11"; system.stateVersion = "23.11";
powerManagement.cpuFreqGovernor = "performance"; powerManagement.cpuFreqGovernor = "performance";

5
user/abacus/default.nix Normal file
View file

@ -0,0 +1,5 @@
{
lukas.imports = [
./lukas
];
}

View file

@ -1,6 +1,5 @@
{pkgs, ...}: { {pkgs, ...}: {
home = { home = {
username = "lukas";
packages = with pkgs; [ packages = with pkgs; [
gitea gitea
]; ];

View file

@ -0,0 +1,5 @@
{
lukas.imports = [
./lukas
];
}

View file

@ -1,6 +1,9 @@
{ {
pkgs,
lib,
...
}: {
home = { home = {
username = "lukas";
stateVersion = "23.11"; stateVersion = "23.11";
}; };
} }

5
user/glacier/default.nix Normal file
View file

@ -0,0 +1,5 @@
{
lukas.imports = [
./lukas
];
}

View file

@ -1,10 +1,13 @@
{pkgs, ...}: { {
pkgs,
lib,
...
}: {
home = { home = {
username = "lukas"; stateVersion = "23.11";
packages = with pkgs; [ packages = with pkgs; [
nvtop-amd nvtop-amd
mullvad-vpn mullvad-vpn
]; ];
stateVersion = "23.11";
}; };
} }

5
user/scenery/default.nix Normal file
View file

@ -0,0 +1,5 @@
{
lukas.imports = [
./lukas
];
}

5
user/vessel/default.nix Normal file
View file

@ -0,0 +1,5 @@
{
lukas.imports = [
./lukas
];
}

View file

@ -1,6 +1,5 @@
{ {pkgs, ...}: {
home = { home = {
username = "lukas";
stateVersion = "23.11"; stateVersion = "23.11";
}; };
} }