From 30fb7851acbc3e660ac18e20a33a683acce7661c Mon Sep 17 00:00:00 2001 From: Leyla Becker Date: Tue, 3 Sep 2024 01:27:10 -0500 Subject: [PATCH] replaced isThinInstallation with isThinUser added util folder --- README.md | 7 ++++--- hosts/defiant/configuration.nix | 5 +---- users/leyla/default.nix | 8 ++++---- users/leyla/packages.nix | 4 ++-- util/default.nix | 8 ++++++++ 5 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 util/default.nix diff --git a/README.md b/README.md index 7cd1f81..4dc35cf 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,13 @@ TODO: keys.txt should prob be readable by owning user only? - graphics driver things should prob be in the hardware-configuration.nix - what does `boot.kernelModules = [ "sg" ]` do? - sops.age.keyFile should not just be hard coded to leyla? -- isThinInstallation -> isThinUser +- use dashes for options not camel case ## New Features - openssh configuration for server - VS code extensions should be installed declaratively -- Flake templates +- Flake templates - https://nix.dev/manual/nix/2.22/command-ref/new-cli/nix3-flake-init - Install all the things on the NAS - firefox declarative??? - figure out steam vr things? -- Open GL? \ No newline at end of file +- Open GL? +- util functions \ No newline at end of file diff --git a/hosts/defiant/configuration.nix b/hosts/defiant/configuration.nix index 99cbde4..05b2f73 100644 --- a/hosts/defiant/configuration.nix +++ b/hosts/defiant/configuration.nix @@ -16,10 +16,7 @@ sops.age.keyFile = "/home/leyla/.config/sops/age/keys.txt"; - users.leyla = { - isNormalUser = true; - isThinInstallation = true; - }; + users.leyla.isThinUser = true; boot.loader.grub = { enable = true; diff --git a/users/leyla/default.nix b/users/leyla/default.nix index 78a9261..7d679cc 100644 --- a/users/leyla/default.nix +++ b/users/leyla/default.nix @@ -9,7 +9,7 @@ in options.users.leyla = { isNormalUser = lib.mkEnableOption "create usable leyla user"; - isThinInstallation = lib.mkEnableOption "are most programs going to be installed or not"; + isThinUser = lib.mkEnableOption "create usable user but witohut user applications"; hasPiperMouse = lib.mkEnableOption "install programs for managing piper supported mouses"; hasOpenRGBHardware = lib.mkEnableOption "install programs for managing openRGB supported hardware"; hasViaKeyboard = lib.mkEnableOption "install programs for managing via supported keyboards"; @@ -34,12 +34,12 @@ in } ( - if cfg.isNormalUser then { + if (cfg.isNormalUser || cfg.isThinUser) then { isNormalUser = true; extraGroups = lib.mkMerge [ ["networkmanager" "wheel" "docker"] ( - lib.mkIf (!cfg.isThinInstallation) [ "adbusers" ] + lib.mkIf (!cfg.isThinUser) [ "adbusers" ] ) ]; @@ -50,6 +50,6 @@ in ) ]; - home-manager.users.leyla = lib.mkIf cfg.isNormalUser (import ./home.nix); + home-manager.users.leyla = lib.mkIf (cfg.isNormalUser || cfg.isThinUser) (import ./home.nix); }; } \ No newline at end of file diff --git a/users/leyla/packages.nix b/users/leyla/packages.nix index f2350b7..7c27a09 100644 --- a/users/leyla/packages.nix +++ b/users/leyla/packages.nix @@ -22,7 +22,7 @@ in programs.adb.enable = true; - users.users.leyla.packages = lib.mkIf cfg.isNormalUser ( + users.users.leyla.packages = lib.mkIf (cfg.isNormalUser || cfg.isThinUser) ( lib.mkMerge [ ( with pkgs; [ @@ -33,7 +33,7 @@ in ] ) ( - lib.mkIf (!cfg.isThinInstallation) ( + lib.mkIf (!cfg.isThinUser) ( with pkgs; [ #foss platforms signal-desktop diff --git a/util/default.nix b/util/default.nix new file mode 100644 index 0000000..795ad04 --- /dev/null +++ b/util/default.nix @@ -0,0 +1,8 @@ +{ lib, ... }: +{ + mkUnless = condition: then: (mkIf (!condition) then); + mkIfElse = condition: then: else: lib.mkMerge [ + (mkIf condition then) + (mkUnless condition else) + ]; +} \ No newline at end of file