Switch to flakes

This commit is contained in:
Tibo De Peuter 2023-03-06 21:00:44 +01:00
parent ba885cb236
commit 5efe0fd5a5
9 changed files with 121 additions and 6 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
pushd ~/projects/sisyphus/nixos pushd ~/projects/sisyphus/nixos
sudo nixos-rebuild switch -I nixos-config=./system/configuration.nix sudo nixos-rebuild switch --flake .#
popd popd

View file

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
pushd ~/projects/sisyphus/nixos pushd ~/projects/sisyphus/nixos
home-manager switch -f ./users/tdpeuter/home.nix nix build .#homeManagerConfigurations.tdpeuter.activationPackage
./result/activate
popd popd

64
nixos/flake.lock Normal file
View file

@ -0,0 +1,64 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1677757546,
"narHash": "sha256-tA1ukoluctzLVyWRaKtD4KlTwgXbUsGB5vcyni1OJ9I=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "86bb69b0b1e10d99a30c4352f230f03106dd0f8a",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-22.11",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1678072060,
"narHash": "sha256-6a9Tbjhir5HxDx4uw0u6Z+LHUfYf7tsT9QxF9FN/32w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "47c003416297e4d59a5e3e7a8b15cdbdf5110560",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.11",
"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",
"version": 7
}

45
nixos/flake.nix Normal file
View file

@ -0,0 +1,45 @@
{
description = "System configuration";
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
home-manager.url = "github:nix-community/home-manager/release-22.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, home-manager, ... }:
let
system = "x86_64-linux"; # Use flake tools?
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
lib = nixpkgs.lib;
in {
homeManagerConfigurations = {
tdpeuter = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
./users/tdpeuter/home.nix
{
home = {
username = "tdpeuter";
homeDirectory = "/home/tdpeuter";
};
}
];
};
};
nixosConfigurations = {
Tibo-NixTest = lib.nixosSystem { # Use hostname
inherit system;
modules = [
./system/configuration.nix
];
};
};
};
}

View file

@ -10,6 +10,12 @@
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
# Nix Flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
# Use the systemd-boot EFI boot loader.] # Use the systemd-boot EFI boot loader.]
boot.loader = { boot.loader = {
systemd-boot.enable = true; systemd-boot.enable = true;

View file

@ -1,2 +0,0 @@
#!/bin/sh
sudo nix-channel --update

View file

@ -1,2 +0,0 @@
#!/bin/sh
nix-channel --update

2
nixos/update.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
nix flake update