From 7867c3a6a7a4705a4bfab936105e21f0e2270a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 2 Aug 2024 08:20:52 +0200 Subject: [PATCH] fix sysusers in noninteractive case --- flake.lock | 18 +++++++++--------- flake.nix | 4 +++- nix/noninteractive.nix | 9 +++++++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index fec4fc6..8a40011 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixos-stable": { "locked": { - "lastModified": 1721409541, - "narHash": "sha256-b6PLr0Ty7JPDBtJtjnYzlBf02bbH9alWMAgispMkTwk=", + "lastModified": 1722372011, + "narHash": "sha256-B2xRiC3NEJy/82ugtareBkRqEkPGpMyjaLxaR8LBxNs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0c53b6b8c2a3e46c68e04417e247bba660689c9d", + "rev": "cf05eeada35e122770c5c14add958790fcfcbef5", "type": "github" }, "original": { @@ -18,16 +18,16 @@ }, "nixos-unstable": { "locked": { - "lastModified": 1721571961, - "narHash": "sha256-jfF4gpRUpTBY2OxDB0FRySsgNGOiuDckEtu7YDQom3Y=", - "owner": "NixOS", + "lastModified": 1722582943, + "narHash": "sha256-PAzeUUnBcWwzHRiOovsaxEFiqUxu6Li1SSlLabkayJA=", + "owner": "Mic92", "repo": "nixpkgs", - "rev": "4cc8b29327bed3d52b40041f810f49734298af46", + "rev": "013b662a4433803218c5587f5e301d213d9aae0c", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable-small", + "owner": "Mic92", + "ref": "iproute2", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index ab15a11..fbde664 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,9 @@ { description = "NixOS images"; - inputs.nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small"; + #inputs.nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small"; + # see https://github.com/NixOS/nixpkgs/pull/331699 + inputs.nixos-unstable.url = "github:Mic92/nixpkgs/iproute2"; inputs.nixos-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; nixConfig.extra-substituters = [ "https://nix-community.cachix.org" ]; diff --git a/nix/noninteractive.nix b/nix/noninteractive.nix index a685e89..95533fc 100644 --- a/nix/noninteractive.nix +++ b/nix/noninteractive.nix @@ -30,6 +30,15 @@ # prevents strace environment.defaultPackages = lib.mkForce [ pkgs.rsync pkgs.parted pkgs.gptfdisk ]; + # normal users are not allowed with sys-users + # see https://github.com/NixOS/nixpkgs/pull/328926 + users.users.nixos = { + isSystemUser = true; + isNormalUser = lib.mkForce false; + }; + users.users.nixos.group = "nixos"; + users.groups.nixos = {}; + # we are missing this from base.nix boot.supportedFilesystems = [ "btrfs"