From 7410af0502d213e20796e6083047d2c75477f646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 27 Feb 2024 09:58:20 +0100 Subject: [PATCH] Add home-manager --- flake.lock | 21 +++++++++++++++++++++ flake.nix | 4 ++++ home/default.nix | 20 ++++++++++++++++++++ home/programs/firefox/default.nix | 9 +++++++++ hosts/prismo/default.nix | 1 + system/users.nix | 3 --- 6 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 home/default.nix create mode 100644 home/programs/firefox/default.nix diff --git a/flake.lock b/flake.lock index 391d4c2..e030cb1 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708988456, + "narHash": "sha256-RCz7Xe64tN2zgWk+MVHkzg224znwqknJ1RnB7rVqUWw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1d085ea4444d26aa52297758b333b449b2aa6fca", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1708807242, @@ -18,6 +38,7 @@ }, "root": { "inputs": { + "home-manager": "home-manager", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 33f294b..36e0372 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, ... }@inputs: diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..2f4774c --- /dev/null +++ b/home/default.nix @@ -0,0 +1,20 @@ +{ inputs, self, user, ...}: { + imports = [ inputs.home-manager.nixosModules.home-manager ]; + home-manager = { + useUserPackages = true; + useGlobalPkgs= true; + extraSpecialArgs = { inherit inputs user; }; + users.${user} = { + imports = [ + ./programs/firefox + ]; + firefox.enable = true; + home = { + username = "${user}"; + homeDirectory = "/home/${user}"; + stateVersion = "23.11"; + }; + programs.home-manager.enable = true; + }; + }; +} diff --git a/home/programs/firefox/default.nix b/home/programs/firefox/default.nix new file mode 100644 index 0000000..f064244 --- /dev/null +++ b/home/programs/firefox/default.nix @@ -0,0 +1,9 @@ +{ pkgs, config, lib, inputs, user, ...}: { + options.firefox.enable = lib.mkEnableOption "Firefox"; + + config = lib.mkIf config.firefox.enable { + programs.firefox = { + enable = true; + }; + }; +} diff --git a/hosts/prismo/default.nix b/hosts/prismo/default.nix index bbee440..11f5b71 100644 --- a/hosts/prismo/default.nix +++ b/hosts/prismo/default.nix @@ -3,5 +3,6 @@ ./configuration.nix ./hardware-configuration.nix ../../system + ../../home ]; } diff --git a/system/users.nix b/system/users.nix index 9ce6c88..64d6fab 100644 --- a/system/users.nix +++ b/system/users.nix @@ -13,9 +13,6 @@ extraGroups = [ "wheel" "networkmanager" ]; # Install some user packages packages = with pkgs; [ - # Browser - firefox - # Editors vscode