Use Flakes
This commit is contained in:
parent
6be5927c61
commit
bf7f910f23
6 changed files with 119 additions and 5 deletions
18
README.adoc
Normal file
18
README.adoc
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
== Build a config and switch to it
|
||||
[source,bash]
|
||||
----
|
||||
sudo nixos-rebuild switch --flake .#thehostname
|
||||
----
|
||||
If `#thehostname` is not provided, it defaults to the current hostname
|
||||
|
||||
== Try to build a configuration
|
||||
[source,bash]
|
||||
----
|
||||
nix build .#nixosConfigurations.thehostname.config.system.build.toplevel
|
||||
----
|
||||
|
||||
== Update lock file to the latest inputs
|
||||
[source,bash]
|
||||
----
|
||||
nix flake update
|
||||
----
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
sudo cp -r configs hosts /etc/nixos/
|
||||
59
flake.lock
generated
Normal file
59
flake.lock
generated
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1625162737,
|
||||
"narHash": "sha256-IzKTw2u/EKVr6TCQYylSAcOnrVRpir3wG3MUHj2LsTc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "7df6656b113ce0d39c8b7d30915cafe046e1d64e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1624922035,
|
||||
"narHash": "sha256-OiIxJQuMRkICxaUwY3xMBbrPPu20de/n7tVYnWzLvS4=",
|
||||
"path": "/nix/store/jc7qnirghr97cvwv84nyxi7iqil0jj8a-source",
|
||||
"rev": "3a8d7958a610cd3fec3a6f424480f91a1b259185",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1624922035,
|
||||
"narHash": "sha256-OiIxJQuMRkICxaUwY3xMBbrPPu20de/n7tVYnWzLvS4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3a8d7958a610cd3fec3a6f424480f91a1b259185",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
42
flake.nix
Normal file
42
flake.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
};
|
||||
|
||||
outputs = { self, home-manager, nixpkgs }: {
|
||||
|
||||
nixosConfigurations.nixos-desktop = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules =
|
||||
[
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
imports = [
|
||||
./hosts/nixos-desktop/configuration.nix
|
||||
];
|
||||
|
||||
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nixosConfigurations.froidmpa-laptop = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules =
|
||||
[
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
imports = [
|
||||
./hosts/froidmpa-laptop/configuration.nix
|
||||
];
|
||||
|
||||
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
<home-manager/nixos>
|
||||
./hardware-configuration.nix
|
||||
../../configs/system.nix
|
||||
../../configs/network.nix
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
<home-manager/nixos>
|
||||
./hardware-configuration.nix
|
||||
../../configs/system.nix
|
||||
../../configs/network.nix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue