From ca33e7d3c00d312701bd008bd512735709702004 Mon Sep 17 00:00:00 2001 From: Charlotte Som Date: Wed, 20 Nov 2024 16:47:55 +0000 Subject: [PATCH] switch to lix module and enable gc / autoupgrade --- flake/flake.lock | 84 +++++++++++++++++++++++++++++++++++++++++++ flake/flake.nix | 10 ++++-- flake/system/auto.nix | 17 +++++++++ flake/system/base.nix | 1 - 4 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 flake/system/auto.nix diff --git a/flake/flake.lock b/flake/flake.lock index 401d3a8..1af2805 100644 --- a/flake/flake.lock +++ b/flake/flake.lock @@ -1,5 +1,73 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flakey-profile": { + "locked": { + "lastModified": 1712898590, + "narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=", + "owner": "lf-", + "repo": "flakey-profile", + "rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d", + "type": "github" + }, + "original": { + "owner": "lf-", + "repo": "flakey-profile", + "type": "github" + } + }, + "lix": { + "inputs": { + "flake-utils": "flake-utils", + "flakey-profile": "flakey-profile", + "lix": "lix_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729360442, + "narHash": "sha256-6U0CyPycIBc04hbYy2hBINnVso58n/ZyywY2BD3hu+s=", + "rev": "9098ac95768f7006d7e070b88bae76939f6034e6", + "type": "tarball", + "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/9098ac95768f7006d7e070b88bae76939f6034e6.tar.gz?rev=9098ac95768f7006d7e070b88bae76939f6034e6" + }, + "original": { + "type": "tarball", + "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz" + } + }, + "lix_2": { + "flake": false, + "locked": { + "lastModified": 1729298361, + "narHash": "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=", + "rev": "ad9d06f7838a25beec425ff406fe68721fef73be", + "type": "tarball", + "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/ad9d06f7838a25beec425ff406fe68721fef73be.tar.gz?rev=ad9d06f7838a25beec425ff406fe68721fef73be" + }, + "original": { + "type": "tarball", + "url": "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz" + } + }, "nixpkgs": { "locked": { "lastModified": 1731797254, @@ -34,9 +102,25 @@ }, "root": { "inputs": { + "lix": "lix", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake/flake.nix b/flake/flake.nix index e60ee39..ba67918 100644 --- a/flake/flake.nix +++ b/flake/flake.nix @@ -3,21 +3,27 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + lix = { + url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, nixpkgs-unstable, ... }@inputs: { + outputs = { self, nixpkgs, nixpkgs-unstable, lix, ... }@inputs: { nixosConfigurations = { plinth = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { unstable-pkgs = nixpkgs-unstable.legacyPackages."x86_64-linux"; + inherit inputs; }; modules = [ - # lix.nixosModules.default + lix.nixosModules.default ({...}: { system.stateVersion = "23.11"; }) ./system/hardware-configuration.nix ./system/base.nix + ./system/auto.nix ./system/software.nix ./system/nginx.nix ./system/borg.nix diff --git a/flake/system/auto.nix b/flake/system/auto.nix new file mode 100644 index 0000000..ef902a4 --- /dev/null +++ b/flake/system/auto.nix @@ -0,0 +1,17 @@ +{ inputs, ... }: { + system.autoUpgrade = { + enable = true; + flake = inputs.self.outPath; + flags = [ + "--update-input" + "nixpkgs" + "--print-build-logs" + ]; + randomizedDelaySec = "45min"; + }; + + nix.gc = { + automatic = true; + options = "--delete-older-than 14d"; + }; +} diff --git a/flake/system/base.nix b/flake/system/base.nix index 0ca67ab..f2e1867 100644 --- a/flake/system/base.nix +++ b/flake/system/base.nix @@ -4,7 +4,6 @@ "nix-command" "flakes" ]; - package = pkgs.lix; }; boot.tmp.cleanOnBoot = true;