finish moving cascade-local out of cascade
This commit is contained in:
parent
8694d5bff1
commit
3c9c9c94d9
63
common/cascade-local.nix
Normal file
63
common/cascade-local.nix
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
with builtins;
|
||||||
|
with import (toString ../functions);
|
||||||
|
|
||||||
|
{pkgs, config, lib, ...}: {
|
||||||
|
|
||||||
|
options = with lib; with types; {
|
||||||
|
cascade.local.git-url = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = nullOr str;
|
||||||
|
description = ''
|
||||||
|
git URL where cascade sources can be found
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = with lib; {
|
||||||
|
#system.activationScripts.cascade-local-source = mkMerge [
|
||||||
|
# (mkIf (config.cascade.local.git-url != null) ''
|
||||||
|
# if [ ! -f /usr/src/cascade-local/.created-by-nixos ];then
|
||||||
|
# mkdir -m 0755 -p /usr/src
|
||||||
|
# # if it's just a symlink, delete it.
|
||||||
|
# if [ -e /usr/src/cascade-local.before-nixos ] ;then
|
||||||
|
# 1>&2 echo "there is already a backup at /usr/src/cascade-local.before-nixos"
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# if [ -h /usr/src/cascade-local.before-nixos ];then
|
||||||
|
# rm -v /usr/src/cascade-local.before-nixos
|
||||||
|
# fi
|
||||||
|
# [ -e /usr/src/cascade-local ] && mv /usr/src/cascade-local /usr/src/cascade-local.before-nixos
|
||||||
|
# ${pkgs.git}/bin/git clone ${config.cascade.source.git-url} /usr/src/cascade-local
|
||||||
|
# touch /usr/src/cascade-local/.created-by-nixosa
|
||||||
|
# fi
|
||||||
|
# '')
|
||||||
|
# (mkIf (config.cascade.local.git-url == null) ''
|
||||||
|
# # if it's a symlink, just delete it.
|
||||||
|
# if [ -h /usr/src/cascade-local ];then
|
||||||
|
# rm -v /usr/src/cascade-local
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# # only cleanup if we actually created /usr/src/cascade-local
|
||||||
|
# if [ -f /usr/src/cascade-local/.created-by-nixos ];then
|
||||||
|
# rm -rf /usr/src/cascade-local && \
|
||||||
|
# [ -e /usr/src/cascade-local.before-nixos ] && mv /usr/src/cascade-local.before-nixos /usr/src/cascade-local
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# mkdir -m 0755 -p /usr/src
|
||||||
|
|
||||||
|
# if [ -h /usr/src/cascade-local.before-nixos ];then
|
||||||
|
# rm -v /usr/src/cascade-local.before-nixos
|
||||||
|
# fi
|
||||||
|
# if [ -e /usr/src/cascade-local ];then
|
||||||
|
# mv /usr/src/cascade-local /usr/src/cascade-local.before-nixos
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# ln -sfn ${<cascade-local>} /usr/src/cascade-local
|
||||||
|
# '')
|
||||||
|
#];
|
||||||
|
# no matter what, we always set cascade-local in NIX_PATH to /usr/src/cascade-local
|
||||||
|
nix.nixPath = [ "cascade-local=/usr/src/cascade-local" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -4,27 +4,25 @@ with import (toString ../functions);
|
||||||
{pkgs, config, lib, ...}: {
|
{pkgs, config, lib, ...}: {
|
||||||
|
|
||||||
options = with lib; with types; {
|
options = with lib; with types; {
|
||||||
cascade.nixpkgs-source = mkOption {
|
#cascade.source.enable = mkOption {
|
||||||
default = null;
|
# default = true;
|
||||||
type = nullOr str;
|
# type = bool;
|
||||||
description = ''
|
# description = ''
|
||||||
where to point nixpkgs in NIX_PATH for the system.
|
# Include cascade source code configured for nixos-rebuild.
|
||||||
|
# '';
|
||||||
if null, nixpkgs will not be set by this module
|
#};
|
||||||
'';
|
#cascade.source.git-url = mkOption {
|
||||||
};
|
# default = "https://gitlab.com/jamesandariese/cascade";
|
||||||
cascade.source.enable = mkOption {
|
# type = str;
|
||||||
default = true;
|
# description = ''
|
||||||
type = bool;
|
# git URL where cascade sources can be found
|
||||||
description = ''
|
# '';
|
||||||
Include cascade source code configured for nixos-rebuild.
|
#};
|
||||||
'';
|
cascade.source.path = mkOption {
|
||||||
};
|
default = "${<cascade>}";
|
||||||
cascade.source.git-url = mkOption {
|
|
||||||
default = "https://gitlab.com/jamesandariese/cascade";
|
|
||||||
type = str;
|
type = str;
|
||||||
description = ''
|
description = ''
|
||||||
git URL where cascade sources can be found
|
where to get cascade source from
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
cascade.source.set-nix-path = mkOption {
|
cascade.source.set-nix-path = mkOption {
|
||||||
|
@ -39,28 +37,30 @@ options = with lib; with types; {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = with lib; {
|
config = with lib; {
|
||||||
system.activationScripts.cascade-source = mkMerge [
|
#system.activationScripts.cascade-source = mkMerge [
|
||||||
(mkIf config.cascade.source.enable ''
|
# (mkIf config.cascade.source.enable ''
|
||||||
if [ ! -f /usr/src/cascade/.created-by-nixos ];then
|
# if [ ! -f /usr/src/cascade/.created-by-nixos ];then
|
||||||
mkdir -m 0755 -p /usr/src /etc/nixos
|
# mkdir -m 0755 -p /usr/src /etc/nixos
|
||||||
# if it's just a symlink, delete it.
|
# # if it's just a symlink, delete it.
|
||||||
[ -e /usr/src/cascade ] && mv /usr/src/cascade /usr/src/cascade.before-nixos
|
# [ -e /usr/src/cascade ] && mv /usr/src/cascade /usr/src/cascade.before-nixos
|
||||||
${pkgs.git}/bin/git clone ${config.cascade.source.git-url} /usr/src/cascade
|
# ${pkgs.git}/bin/git clone ${config.cascade.source.git-url} /usr/src/cascade
|
||||||
touch /usr/src/cascade/.created-by-nixos
|
# touch /usr/src/cascade/.created-by-nixos
|
||||||
fi
|
# fi
|
||||||
'')
|
# '')
|
||||||
(mkIf (!config.cascade.source.enable) ''
|
# (mkIf (!config.cascade.source.enable) ''
|
||||||
# only cleanup if we actually created /usr/src/cascade
|
# # only cleanup if we actually created /usr/src/cascade
|
||||||
if [ -f /usr/src/cascade/.created-by-nixos ];then
|
# if [ -f /usr/src/cascade/.created-by-nixos ];then
|
||||||
rm -rf /usr/src/cascade && \
|
# rm -rf /usr/src/cascade && \
|
||||||
[ -e /usr/src/cascade.before-nixos ] && mv /usr/src/cascade.before-nixos /usr/src/cascade
|
# [ -e /usr/src/cascade.before-nixos ] && mv /usr/src/cascade.before-nixos /usr/src/cascade
|
||||||
fi
|
# fi
|
||||||
'')
|
# '')
|
||||||
];
|
#];
|
||||||
|
|
||||||
nix.nixPath = mkMerge [
|
nix.nixPath = mkMerge [
|
||||||
(mkIf (config.cascade.nixpkgs-source != null) [ "nixpkgs=${config.cascade.nixpkgs-source}" ])
|
[ "nixpkgs=${import <cascade-local/nixpkgs-path.nix>}" ]
|
||||||
(mkIf (config.cascade.source.set-nix-path && config.cascade.source.enable) [ "cascade=/usr/src/cascade" ])
|
[ "cascade=${config.cascade.source.path}" ]
|
||||||
(mkIf (!(config.cascade.source.set-nix-path && config.cascade.source.enable)) [ "cascade=https://gitlab.com/jamesandariese/cascade/-/archive/main/cascade-main.tar.gz" ])
|
#(mkIf (config.cascade.source.set-nix-path && config.cascade.source.enable) [ "cascade=/usr/src/cascade" ])
|
||||||
|
#(mkIf (!(config.cascade.source.set-nix-path && config.cascade.source.enable)) [ "cascade=https://gitlab.com/jamesandariese/cascade/-/archive/main/cascade-main.tar.gz" ])
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
with builtins;
|
|
||||||
|
|
||||||
{}:
|
|
||||||
let
|
|
||||||
myisoconfig = import ./hosts/_basic.nix;
|
|
||||||
|
|
||||||
copyChannel = true;
|
|
||||||
system = "x86_64-linux";
|
|
||||||
evalNixos = configuration: import <nixpkgs/nixos> {
|
|
||||||
inherit system configuration;
|
|
||||||
};
|
|
||||||
resultOfEval = (evalNixos myisoconfig);
|
|
||||||
lib = resultOfEval.pkgs.lib;
|
|
||||||
pkgs = resultOfEval.pkgs;
|
|
||||||
config = resultOfEval.config;
|
|
||||||
in
|
|
||||||
import <nixpkgs/nixos/lib/make-disk-image.nix> {
|
|
||||||
inherit lib copyChannel pkgs config;
|
|
||||||
diskSize = "20480";
|
|
||||||
format = "raw";
|
|
||||||
installBootLoader = true;
|
|
||||||
partitionTableType = "hybrid";
|
|
||||||
}
|
|
3
hosts/.gitignore
vendored
3
hosts/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
||||||
*.nix
|
|
||||||
!_*.nix
|
|
||||||
!default.nix
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
(toString ../profiles/qemu-vm-install-media)
|
|
||||||
];
|
|
||||||
config = {
|
|
||||||
#deployment.targetHost = "";
|
|
||||||
#deployment.targetUser = "";
|
|
||||||
#deployment.targetPort = "";
|
|
||||||
networking.hostName = "nixos";
|
|
||||||
#networking.interfaces.br0.ipv4.addresses = [ ];
|
|
||||||
#networking.interfaces.br0.ipv4.routes = [ {address = "0.0.0.0"; prefixLength = 0; via = "172.16.1.1"; } ];
|
|
||||||
#networking.interfaces.br0.useDHCP = false;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
let _ = builtins.trace "${toString ./.}/default.nix"; in
|
|
||||||
with builtins;
|
|
||||||
with import (toString ../functions);
|
|
||||||
|
|
||||||
let hosts = import-folder {path = "${toString ./.}"; filenameMatch = ".*[.]nix"; filenameBadMatch = ".*_.*";};
|
|
||||||
in
|
|
||||||
|
|
||||||
{...}:
|
|
||||||
mapAttrs (hostname: hostdef:
|
|
||||||
|
|
||||||
{...}: hostdef
|
|
||||||
|
|
||||||
) hosts
|
|
|
@ -1,15 +0,0 @@
|
||||||
let pkgs = import <nixpkgs> {};
|
|
||||||
in
|
|
||||||
|
|
||||||
if pkgs == null then
|
|
||||||
builtins.fetchGit {
|
|
||||||
url = "https://github.com/nixos/nixpkgs";
|
|
||||||
ref = "master";
|
|
||||||
rev = "da4c6be0187a694bdeb3efc28b29ee0e4c30702f";
|
|
||||||
shallow = true;
|
|
||||||
}
|
|
||||||
else pkgs.fetchgit {
|
|
||||||
url = "https://github.com/nixos/nixpkgs";
|
|
||||||
rev = "da4c6be0187a694bdeb3efc28b29ee0e4c30702f";
|
|
||||||
sha256 = "sha256-1rcG6x0vKnnzGhABPg/QvL75DzhJxM810wZKAukoF1M=";
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user