Skip to content
Snippets Groups Projects
Commit 210e46e2 authored by Jens Nolte's avatar Jens Nolte
Browse files

Move some flake inputs from machines repository here

parent 226bae05
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,10 @@ else
fi
# Update nar-hash of dotfiles repository
nix flake lock --update-input dotfiles "path:$MACHINES_PATH"
if [[ "$operation" = "iso" ]]
then
print_info "Building iso image"
......@@ -109,6 +113,12 @@ readonly system_installable="path:$MACHINES_PATH#nixosConfigurations.$hostname.c
readonly nixos_config_path=$(nix path-info $common_nix_flags --json "$system_installable" | jq --raw-output ".[0].path")
print >&2 "$nixos_config_path"
if [[ -z "$nixos_config_path" ]]
then
print_error "No path was generated"
exit 3
fi
print_info "Deploying target system configuration"
if [[ "$is_target_host" || "$operation" = "build" ]]
......
......@@ -2,6 +2,7 @@
{ name, path, channel, isIso, extraLayersDir, flakeInputs, flakeOutputs, system, extraOverlays }:
{ lib, config, pkgs, ... }:
let
installResult = builtins.fromJSON (builtins.readFile (path + "/install-result.json"));
dotfilesConfig = import (path + "/dotfiles.nix");
......@@ -68,6 +69,10 @@ in
# Make nixpkgs path available inside of the configuration
#_module.args.nixpkgsPath = channel;
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = lib.mkIf (flakeInputs.self ? rev) flakeInputs.self.rev;
environment.shellAliases = {
# nixos-option won't run without a configuration. With an empty config it does not show configured values, but can at least be used to search options and show default values.
nixos-option = "nixos-option -I nixos-config=${pkgs.writeText "empty-configuration.nix" "{...}:{}"}";
......
{
"nodes": {
"homemanager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1617220862,
"narHash": "sha256-nLka+S6Vww8hTF3ZkzK/BezvgAo1Z433/L6TR1SiXyM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ad04237d5142f53dcba258942b78e2d2bbf210c8",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1617082367,
"narHash": "sha256-W0cQPGjc4IVzryaGycuoS8KZkXafS1P23w/fcKLoD5Y=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "04a2b269d8921505a2969fc9ec25c1f517f2b307",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"q": {
"inputs": {
"nixpkgs": [
"qd",
"nixpkgs"
],
"qd": [
"qd"
]
},
"locked": {
"host": "git.c3pb.de",
"lastModified": 1614196923,
"narHash": "sha256-Yjnd3hSW1XpZ9BQJCUeC0ES3KrWe6kubh22wkxEp9xE=",
"owner": "jens",
"repo": "q",
"rev": "1002c6c644bb377a22a8ac5a8ac9e54bcb055874",
"type": "gitlab"
},
"original": {
"host": "git.c3pb.de",
"owner": "jens",
"repo": "q",
"type": "gitlab"
}
},
"qauth": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"host": "git.c3pb.de",
"lastModified": 1611110209,
"narHash": "sha256-PGJWsILu0NO8ERv8+fgKFf6idkDuZgFlJGtGWdJsV8A=",
"owner": "jens",
"repo": "qauth",
"rev": "72d18c270a256434c18b1fadd68755413dd8fdb6",
"type": "gitlab"
},
"original": {
"host": "git.c3pb.de",
"owner": "jens",
"repo": "qauth",
"type": "gitlab"
}
},
"qd": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"host": "git.c3pb.de",
"lastModified": 1615431166,
"narHash": "sha256-ZwR9s18dGMrPJ+SLFOTL2BCsd4eZ6dd86v+Z7M2LSZc=",
"owner": "jens",
"repo": "qd",
"rev": "49571704277e7f59712622dc2c87ee18b226da31",
"type": "gitlab"
},
"original": {
"host": "git.c3pb.de",
"owner": "jens",
"repo": "qd",
"type": "gitlab"
}
},
"root": {
"inputs": {
"homemanager": "homemanager",
"nixpkgs": "nixpkgs",
"q": "q",
"qauth": "qauth",
"qd": "qd"
}
}
},
"root": "root",
"version": 7
}
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
#homemanager = {
# url = github:nix-community/home-manager;
# inputs.nixpkgs.follows = "nixpkgs";
#};
#qauth = {
# url = gitlab:jens/qauth?host=git.c3pb.de;
# inputs.nixpkgs.follows = "nixpkgs";
#};
homemanager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
qauth = {
url = gitlab:jens/qauth?host=git.c3pb.de;
inputs.nixpkgs.follows = "nixpkgs";
};
qd = {
url = gitlab:jens/qd?host=git.c3pb.de;
inputs.nixpkgs.follows = "nixpkgs";
};
q = {
url = gitlab:jens/q?host=git.c3pb.de;
inputs.qd.follows = "qd";
inputs.nixpkgs.follows = "qd/nixpkgs";
};
};
outputs = { ... }: {
overlay = import ./pkgs;
nixosModules = {
greetd = import ./modules/greetd.nix;
outputs = inputs_@{ self, nixpkgs, ... }: {
machine-manager = (import ./machine-manager.nix) {
flakeInputs = inputs_;
flakeOutputs = self;
};
overlay = import ./pkgs;
};
}
# entry point for machine configurations:
# (import <repo-path> { machinesDir=./machines }).<netname>.configurations.<hostname>
{ flakeInputs, flakeOutputs, machinesDir, extraLayersDir, extraOverlays ? [] }:
# applied by this repositories flake
{ flakeInputs, flakeOutputs }:
# applied by outer flake
{ extraFlakeInputs, extraFlakeOutputs, machinesDir, extraLayersDir, extraOverlays ? [] }:
with builtins;
with flakeInputs.nixpkgs.lib;
let
finalFlakeInputs = flakeInputs // extraFlakeInputs;
finalFlakeOutputs = flakeOutputs // extraFlakeOutputs;
# defaultChannel :: path (channel)
#defaultChannel = loadChannel "nixos-unstable";
......@@ -19,7 +21,7 @@ let
# allChannels :: { *: path (channel) }
#allChannels = with helpers; keysToAttrs loadChannel (readFilterDir (filterAnd [(not filterDirHidden) filterDirDirs]) channelsDir);
# getMachineChannel :: string -> path
getMachineChannel = _: flakeInputs.nixpkgs;
getMachineChannel = _: finalFlakeInputs.nixpkgs;
#getMachineChannel = { name, path }:
# let
# channelFile = path + "/channel.nix";
......@@ -36,17 +38,19 @@ let
evaluateConfig = pkgs: args: (import "${pkgs}/nixos/lib/eval-config.nix" args).config;
mkNixosSystemDerivations = { name, path }:
let
channel = flakeInputs.nixpkgs;
channel = finalFlakeInputs.nixpkgs;
system = "x86_64-linux";
mkMachineConfig = { name, path, isIso }: {
imports = [
(import ./configuration.nix {
inherit name path isIso extraLayersDir flakeInputs flakeOutputs system extraOverlays;
inherit name path isIso extraLayersDir system extraOverlays;
flakeInputs = finalFlakeInputs;
flakeOutputs = finalFlakeOutputs;
channel = machineChannels.${name};
})
];
_module.args.flakeInputs = flakeInputs;
_module.args.flakeOutputs = flakeOutputs;
_module.args.flakeInputs = finalFlakeInputs;
_module.args.flakeOutputs = finalFlakeOutputs;
_module.args.system = system;
};
configuration = mkMachineConfig { inherit name path; isIso = false; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment