From 8002a8f725dba6944256f39e6932e7e9f204edc1 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Sat, 14 Dec 2024 08:42:24 +0100 Subject: [PATCH] cosmic --- classes/desktop/cosmic.nix | 15 ++++ classes/desktop/networking.nix | 29 +------ classes/desktop/xdg.nix | 3 + common/agenix.nix | 5 ++ flake.lock | 136 ++++++++++++++++++++++++++------- flake.nix | 22 ++++-- lib.nix | 4 +- 7 files changed, 149 insertions(+), 65 deletions(-) create mode 100644 classes/desktop/cosmic.nix create mode 100644 classes/desktop/xdg.nix create mode 100644 common/agenix.nix diff --git a/classes/desktop/cosmic.nix b/classes/desktop/cosmic.nix new file mode 100644 index 0000000..3c3caf6 --- /dev/null +++ b/classes/desktop/cosmic.nix @@ -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; + }; +} diff --git a/classes/desktop/networking.nix b/classes/desktop/networking.nix index b5f5f01..62c30e7 100644 --- a/classes/desktop/networking.nix +++ b/classes/desktop/networking.nix @@ -3,39 +3,12 @@ in { services.resolved.enable = true; - # TODO networking = { networkmanager = { enable = true; dns = "systemd-resolved"; }; - firewall = { - 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; - } - ]; - }; + firewall.enable = false; }; users.users.${mainUser}.extraGroups = ["networkmanager"]; diff --git a/classes/desktop/xdg.nix b/classes/desktop/xdg.nix new file mode 100644 index 0000000..a5a81d9 --- /dev/null +++ b/classes/desktop/xdg.nix @@ -0,0 +1,3 @@ +{ + xdg.portal.xdgOpenUsePortal = true; +} diff --git a/common/agenix.nix b/common/agenix.nix new file mode 100644 index 0000000..aff3765 --- /dev/null +++ b/common/agenix.nix @@ -0,0 +1,5 @@ +{inputs, ...}: { + imports = [ + inputs.agenix.nixosModules.default + ]; +} diff --git a/flake.lock b/flake.lock index 9aa85ff..4c128d8 100644 --- a/flake.lock +++ b/flake.lock @@ -59,16 +59,32 @@ "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": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", "type": "github" }, "original": { @@ -85,11 +101,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1732021966, - "narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=", + "lastModified": 1733665616, + "narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "3308484d1a443fc5bc92012435d79e80458fe43c", + "rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a", "type": "github" }, "original": { @@ -121,11 +137,11 @@ }, "hardware": { "locked": { - "lastModified": 1733066523, - "narHash": "sha256-aQorWITXZu7b095UwnpUvcGt9dNJie/GO9r4hZfe2sU=", + "lastModified": 1733861262, + "narHash": "sha256-+jjPup/ByS0LEVIrBbt7FnGugJgLeG9oc+ivFASYn2U=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "fe01780d356d70fd119a19277bff71d3e78dad00", + "rev": "cf737e2eba82b603f54f71b10cb8fd09d22ce3f5", "type": "github" }, "original": { @@ -160,11 +176,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1730417950, - "narHash": "sha256-2Lh+av929qXmYRIZ5FONrWCUWrvDFLVID2deEZCn4ek=", + "lastModified": 1733412713, + "narHash": "sha256-H4uxy/E/z71bEq1/pIoPI+yi8h9+S8hBMg5+pVYTKIo=", "owner": "lukaswrz", "repo": "hxwrap", - "rev": "13f97ac98899eaa33481aa912b42cf7350d16211", + "rev": "7d7f9e48a4fbac0b8c198d13e0e733c9b8c57433", "type": "github" }, "original": { @@ -173,6 +189,27 @@ "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": { "locked": { "lastModified": 1703013332, @@ -191,14 +228,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1730504152, - "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" } }, "nixpkgs-stable": { @@ -217,6 +254,22 @@ "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": { "locked": { "lastModified": 1730768919, @@ -235,11 +288,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1730200266, - "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", + "lastModified": 1733212471, + "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", + "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", "type": "github" }, "original": { @@ -251,11 +304,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1732837521, - "narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=", + "lastModified": 1733940404, + "narHash": "sha256-Pj39hSoUA86ZePPF/UXiYHHM7hMIkios8TYG29kQT4g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "970e93b9f82e2a0f3675757eb0bfc73297cc6370", + "rev": "5d67ea6b4b63378b9c13be21e2ec9d1afc921713", "type": "github" }, "original": { @@ -267,11 +320,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1731890469, - "narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=", + "lastModified": 1733097829, + "narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5083ec887760adfe12af64830a66807423a859a7", + "rev": "2c15aa59df0017ca140d9ba302412298ab4bf22a", "type": "github" }, "original": { @@ -288,10 +341,35 @@ "git-hooks": "git-hooks", "hardware": "hardware", "hxwrap": "hxwrap", - "nixpkgs": "nixpkgs_4", + "nixos-cosmic": "nixos-cosmic", + "nixpkgs": [ + "nixos-cosmic", + "nixpkgs" + ], "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": { "locked": { "lastModified": 1681028828, @@ -312,11 +390,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1732894027, - "narHash": "sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII+oAc=", + "lastModified": 1733761991, + "narHash": "sha256-s4DalCDepD22jtKL5Nw6f4LP5UwoMcPzPZgHWjAfqbQ=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "6209c381904cab55796c5d7350e89681d3b2a8ef", + "rev": "0ce9d149d99bc383d1f2d85f31f6ebd146e46085", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 85c5033..3c614a2 100644 --- a/flake.nix +++ b/flake.nix @@ -3,12 +3,27 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + + # Pre-commit git-hooks.url = "github:cachix/git-hooks.nix"; + + # Formatting treefmt.url = "github:numtide/treefmt-nix"; + + # Hardware support hardware.url = "github:NixOS/nixos-hardware"; + + # Agenix agenix.url = "github:ryantm/agenix"; + + # Helix hxwrap.url = "github:lukaswrz/hxwrap"; + + # COSMIC + nixos-cosmic.url = "github:lilyinstarlight/nixos-cosmic"; + nixpkgs.follows = "nixos-cosmic/nixpkgs"; }; outputs = { @@ -29,12 +44,7 @@ flake = { lib = nixpkgs.lib.extend (import ./lib.nix); - nixosConfigurations = self.lib.genNixosConfigurations { - inherit inputs; - extraModules = [ - inputs.agenix.nixosModules.default - ]; - }; + nixosConfigurations = self.lib.genNixosConfigurations {inherit inputs;}; }; perSystem = { diff --git a/lib.nix b/lib.nix index 28184c3..8656fa0 100644 --- a/lib.nix +++ b/lib.nix @@ -28,7 +28,7 @@ lib: _: { genNixosConfigurations = { inputs, - extraModules, + extraModules ? _: [], }: let commonDir = ./common; classesDir = ./classes; @@ -54,7 +54,7 @@ lib: _: { ++ [ {networking.hostName = lib.mkDefault name;} ] - ++ extraModules; + ++ (extraModules {inherit class name;}); }; dirsIn = dir: