Add flake with home-manager

This commit is contained in:
Florian RICHER 2023-02-02 00:17:10 +01:00
parent a5186ea3d6
commit 500d8a4fd4
5 changed files with 109 additions and 13 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/result

View file

@ -12,4 +12,13 @@ Build and switch
```bash
nixos-rebuild switch --flake .#<hostname>
```
Build script to activate in current shell
```bash
nix build .#hmConfig.<hostname>.activationPackage
```
with
```bash
./result/activate
```

View file

@ -1,25 +1,60 @@
{
"nodes": {
"nixpkgs": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1675183161,
"narHash": "sha256-Zq8sNgAxDckpn7tJo7V1afRSk2eoVbu3OjI1QklGLNg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e1e1b192c1a5aab2960bf0a0bd53a2e8124fa18e",
"lastModified": 1675247113,
"narHash": "sha256-+YcXjfCP4hNu8A68b/UoXFCTDwKLuLV+x/7dQnM5U/o=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "782cb855b2f23c485011a196c593e2d7e4fce746",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1675158573,
"narHash": "sha256-HkKEZA/8mt7iJ2eotjPMz6XUdjBW8E2aH0AoqLJ9vEs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e3945057be467f32028ff6b67403be08285ad8c8",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View file

@ -2,10 +2,14 @@
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs }:
outputs = { self, nixpkgs, home-manager }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
@ -15,9 +19,33 @@
lib = nixpkgs.lib;
in {
nixosConfigurations = {
nixos-desktop = lib.nixosSystem {
florian = lib.nixosSystem {
inherit system;
modules = [ ./configuration.nix ];
modules = [
./configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.florian = {
imports = [ ./home.nix ];
};
}
];
};
};
hmConfig = {
florian = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
./home.nix
{
home = {
username = "florian";
homeDirectory = "/home/florian";
stateVersion = "22.11";
};
}
];
};
};
};

23
home.nix Normal file
View file

@ -0,0 +1,23 @@
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "florian";
home.homeDirectory = "/home/florian";
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "22.11";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.packages = with pkgs; [ htop ];
}