diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..e0336e9 --- /dev/null +++ b/README.adoc @@ -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 +---- diff --git a/copyToEtc.sh b/copyToEtc.sh deleted file mode 100755 index 24b898c..0000000 --- a/copyToEtc.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -sudo cp -r configs hosts /etc/nixos/ \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c780f4d --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fc28d6d --- /dev/null +++ b/flake.nix @@ -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; + } + ]; + }; + + }; +} diff --git a/hosts/froidmpa-laptop/configuration.nix b/hosts/froidmpa-laptop/configuration.nix index 5ced5d9..e0edb17 100644 --- a/hosts/froidmpa-laptop/configuration.nix +++ b/hosts/froidmpa-laptop/configuration.nix @@ -1,7 +1,6 @@ { config, lib, pkgs, ... }: { imports = [ - ./hardware-configuration.nix ../../configs/system.nix ../../configs/network.nix diff --git a/hosts/nixos-desktop/configuration.nix b/hosts/nixos-desktop/configuration.nix index 75bc386..df6e81a 100644 --- a/hosts/nixos-desktop/configuration.nix +++ b/hosts/nixos-desktop/configuration.nix @@ -1,7 +1,6 @@ { config, lib, pkgs, ... }: { imports = [ - ./hardware-configuration.nix ../../configs/system.nix ../../configs/network.nix