This commit is contained in:
Lukas Wurzinger 2024-12-14 08:42:24 +01:00
parent 1bde6e75f0
commit 8002a8f725
7 changed files with 149 additions and 65 deletions

View file

@ -0,0 +1,15 @@
{inputs, ...}: {
imports = [
inputs.nixos-cosmic.nixosModules.default
];
nix.settings = {
substituters = ["https://cosmic.cachix.org/"];
trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="];
};
services = {
desktopManager.cosmic.enable = true;
displayManager.cosmic-greeter.enable = true;
};
}

View file

@ -3,39 +3,12 @@
in { in {
services.resolved.enable = true; services.resolved.enable = true;
# TODO
networking = { networking = {
networkmanager = { networkmanager = {
enable = true; enable = true;
dns = "systemd-resolved"; dns = "systemd-resolved";
}; };
firewall = { firewall.enable = false;
allowedTCPPorts = [
# Spotify track sync
57621
# Steam Remote Play
27036
# Source Dedicated Server SRCDS Rcon port
27015
# Syncthing TCP based sync protocol traffic
22000
];
allowedUDPPorts = [
# Source Dedicated Server gameplay traffic
27015
# Syncthing QUIC based sync protocol traffic
22000
# Syncthing port for discovery broadcasts on IPv4 and multicasts on IPv6
21027
];
allowedUDPPortRanges = [
# Steam Remote Play
{
from = 27031;
to = 27036;
}
];
};
}; };
users.users.${mainUser}.extraGroups = ["networkmanager"]; users.users.${mainUser}.extraGroups = ["networkmanager"];

3
classes/desktop/xdg.nix Normal file
View file

@ -0,0 +1,3 @@
{
xdg.portal.xdgOpenUsePortal = true;
}

5
common/agenix.nix Normal file
View file

@ -0,0 +1,5 @@
{inputs, ...}: {
imports = [
inputs.agenix.nixosModules.default
];
}

View file

@ -59,16 +59,32 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1717312683,
"narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1730504689, "lastModified": 1733312601,
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "506278e768c2a08bec68eb62932193e341f55c90", "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -85,11 +101,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1732021966, "lastModified": 1733665616,
"narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=", "narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "3308484d1a443fc5bc92012435d79e80458fe43c", "rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -121,11 +137,11 @@
}, },
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1733066523, "lastModified": 1733861262,
"narHash": "sha256-aQorWITXZu7b095UwnpUvcGt9dNJie/GO9r4hZfe2sU=", "narHash": "sha256-+jjPup/ByS0LEVIrBbt7FnGugJgLeG9oc+ivFASYn2U=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "fe01780d356d70fd119a19277bff71d3e78dad00", "rev": "cf737e2eba82b603f54f71b10cb8fd09d22ce3f5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -160,11 +176,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1730417950, "lastModified": 1733412713,
"narHash": "sha256-2Lh+av929qXmYRIZ5FONrWCUWrvDFLVID2deEZCn4ek=", "narHash": "sha256-H4uxy/E/z71bEq1/pIoPI+yi8h9+S8hBMg5+pVYTKIo=",
"owner": "lukaswrz", "owner": "lukaswrz",
"repo": "hxwrap", "repo": "hxwrap",
"rev": "13f97ac98899eaa33481aa912b42cf7350d16211", "rev": "7d7f9e48a4fbac0b8c198d13e0e733c9b8c57433",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -173,6 +189,27 @@
"type": "github" "type": "github"
} }
}, },
"nixos-cosmic": {
"inputs": {
"flake-compat": "flake-compat_2",
"nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable_2",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1734142491,
"narHash": "sha256-FkcW2uOOZePE9ZaBusIziBAiNkEUup/7FVi78E2G+7c=",
"owner": "lilyinstarlight",
"repo": "nixos-cosmic",
"rev": "01a253ee83b7394626aeac9e89dcba0e085412eb",
"type": "github"
},
"original": {
"owner": "lilyinstarlight",
"repo": "nixos-cosmic",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1703013332, "lastModified": 1703013332,
@ -191,14 +228,14 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1730504152, "lastModified": 1733096140,
"narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
@ -217,6 +254,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1733808091,
"narHash": "sha256-KWwINTQelKOoQgrXftxoqxmKFZb9pLVfnRvK270nkVk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a0f3e10d94359665dba45b71b4227b0aeb851f8e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1730768919, "lastModified": 1730768919,
@ -235,11 +288,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1730200266, "lastModified": 1733212471,
"narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -251,11 +304,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1732837521, "lastModified": 1733940404,
"narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=", "narHash": "sha256-Pj39hSoUA86ZePPF/UXiYHHM7hMIkios8TYG29kQT4g=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "970e93b9f82e2a0f3675757eb0bfc73297cc6370", "rev": "5d67ea6b4b63378b9c13be21e2ec9d1afc921713",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -267,11 +320,11 @@
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1731890469, "lastModified": 1733097829,
"narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=", "narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5083ec887760adfe12af64830a66807423a859a7", "rev": "2c15aa59df0017ca140d9ba302412298ab4bf22a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -288,10 +341,35 @@
"git-hooks": "git-hooks", "git-hooks": "git-hooks",
"hardware": "hardware", "hardware": "hardware",
"hxwrap": "hxwrap", "hxwrap": "hxwrap",
"nixpkgs": "nixpkgs_4", "nixos-cosmic": "nixos-cosmic",
"nixpkgs": [
"nixos-cosmic",
"nixpkgs"
],
"treefmt": "treefmt" "treefmt": "treefmt"
} }
}, },
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixos-cosmic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1734057252,
"narHash": "sha256-fpSFuiW+O2L0ru2GrXBS0wcAYV9+yDE0Gf800UsWutY=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "1f56a5c88e4dcaa0ab1ba04c4bc5a977cff840b2",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
@ -312,11 +390,11 @@
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_5"
}, },
"locked": { "locked": {
"lastModified": 1732894027, "lastModified": 1733761991,
"narHash": "sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII+oAc=", "narHash": "sha256-s4DalCDepD22jtKL5Nw6f4LP5UwoMcPzPZgHWjAfqbQ=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "6209c381904cab55796c5d7350e89681d3b2a8ef", "rev": "0ce9d149d99bc383d1f2d85f31f6ebd146e46085",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -3,12 +3,27 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
# Pre-commit
git-hooks.url = "github:cachix/git-hooks.nix"; git-hooks.url = "github:cachix/git-hooks.nix";
# Formatting
treefmt.url = "github:numtide/treefmt-nix"; treefmt.url = "github:numtide/treefmt-nix";
# Hardware support
hardware.url = "github:NixOS/nixos-hardware"; hardware.url = "github:NixOS/nixos-hardware";
# Agenix
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
# Helix
hxwrap.url = "github:lukaswrz/hxwrap"; hxwrap.url = "github:lukaswrz/hxwrap";
# COSMIC
nixos-cosmic.url = "github:lilyinstarlight/nixos-cosmic";
nixpkgs.follows = "nixos-cosmic/nixpkgs";
}; };
outputs = { outputs = {
@ -29,12 +44,7 @@
flake = { flake = {
lib = nixpkgs.lib.extend (import ./lib.nix); lib = nixpkgs.lib.extend (import ./lib.nix);
nixosConfigurations = self.lib.genNixosConfigurations { nixosConfigurations = self.lib.genNixosConfigurations {inherit inputs;};
inherit inputs;
extraModules = [
inputs.agenix.nixosModules.default
];
};
}; };
perSystem = { perSystem = {

View file

@ -28,7 +28,7 @@ lib: _: {
genNixosConfigurations = { genNixosConfigurations = {
inputs, inputs,
extraModules, extraModules ? _: [],
}: let }: let
commonDir = ./common; commonDir = ./common;
classesDir = ./classes; classesDir = ./classes;
@ -54,7 +54,7 @@ lib: _: {
++ [ ++ [
{networking.hostName = lib.mkDefault name;} {networking.hostName = lib.mkDefault name;}
] ]
++ extraModules; ++ (extraModules {inherit class name;});
}; };
dirsIn = dir: dirsIn = dir: