Compare commits
No commits in common. "21b953f274520897b8d4f05571575a8d8bd61a10" and "a6d89b6ce5f5fae7f12f45fd0b603305fdfe0b83" have entirely different histories.
21b953f274
...
a6d89b6ce5
|
|
@ -1,2 +1,2 @@
|
|||
result
|
||||
*.qcow2
|
||||
nixos.qcow2
|
||||
12
README.md
12
README.md
|
|
@ -1,15 +1,3 @@
|
|||
# Installing on a new machine
|
||||
|
||||
1) Install [NixOS](https://nixos.org/) from an ISO via USB
|
||||
2) Reboot machine
|
||||
3) Edit /etc/nixos/configuration and add `git` to packages
|
||||
4) Clone this repo
|
||||
5) Copy new `host/` configuration for the new machine
|
||||
6) Copy /etc/nixos/hardware-configuration to `host/<host>/hardware.nix`
|
||||
7) Edit `flake.nix` to point to the new `host`
|
||||
8) `git add .`
|
||||
9) Run `sudo nixos-rebuild switch --flake .#nixos`
|
||||
|
||||
# Building NixOS VM
|
||||
`nix build .#nixosConfigurations.nixosvm.config.system.build.vm`
|
||||
https://gist.github.com/FlakM/0535b8aa7efec56906c5ab5e32580adf
|
||||
|
|
|
|||
17
flake.lock
17
flake.lock
|
|
@ -158,22 +158,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"install-system": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"path": "scripts/install-system",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"path": "scripts/install-system",
|
||||
"type": "path"
|
||||
},
|
||||
"parent": []
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1753345091,
|
||||
|
|
@ -219,7 +203,6 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"install-system": "install-system",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"stylix": "stylix"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,9 @@
|
|||
url = "github:danth/stylix/release-25.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
install-system = {
|
||||
url = "path:scripts/install-system";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, install-system, ... } @ inputs: let
|
||||
outputs = { nixpkgs, home-manager, ... } @ inputs: let
|
||||
system = "x86_64-linux";
|
||||
host = "vm";
|
||||
profile = "vm";
|
||||
|
|
@ -48,7 +43,6 @@
|
|||
};
|
||||
modules = [
|
||||
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
|
||||
{ environment.systemPackages = [ install-system.packages.${system}.default ]; }
|
||||
./hosts/${host}
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
networking = {
|
||||
hostName = "${host}";
|
||||
networkmanager.enable = true;
|
||||
wireless.enable = false;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ networkmanagerapplet ];
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ in
|
|||
then [ pkgs.hyprland ]
|
||||
else [])
|
||||
++ (if plasmaCfg.enable
|
||||
# TODO: use the correct packages or config
|
||||
then [ pkgs.kdePackages.kde-gtk-config ]
|
||||
else []);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#/usr/bin/env bash
|
||||
|
||||
echo "Removing old qcow2 disk ..."
|
||||
rm -f ./vm.qcow2
|
||||
rm -f ./nixos.qcow2
|
||||
|
||||
echo "Building new VM ..."
|
||||
nix build .#nixosConfigurations.nixosvm.config.system.build.vm
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1753749649,
|
||||
"narHash": "sha256-+jkEZxs7bfOKfBIk430K+tK9IvXlwzqQQnppC2ZKFj4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1f08a4df998e21f4e8be8fb6fbf61d11a1a5076a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-25.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
description = "_template package and shell environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
||||
name = builtins.baseNameOf (builtins.toString ./.);
|
||||
shellApplication = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
|
||||
text = builtins.readFile ./${name}.sh;
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
unixtools.column
|
||||
];
|
||||
};
|
||||
in {
|
||||
packages.${system}.default = shellApplication;
|
||||
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
packages = [ shellApplication ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# https://github.com/nicolas-goudry/nix-config
|
||||
|
||||
# set +e # Do not exit on error
|
||||
set -e # Exit on error
|
||||
set +u # Allow unset variables
|
||||
# set -u # Exit on unset variable
|
||||
# set +o pipefail # Disable pipefail
|
||||
set -o pipefail # Enable pipefail
|
||||
|
||||
script_name=$(basename "${0}")
|
||||
nc="\e[0m" # Unset styles
|
||||
bld="\e[1m" # Bold text
|
||||
dim="\e[2m" # Dim text
|
||||
red="\e[31m" # Red foreground
|
||||
green="\e[32m" # Green foreground
|
||||
yellow="\e[33m" # Yellow foreground
|
||||
blue="\e[34m" # Blue foreground
|
||||
|
||||
to_stderr() {
|
||||
>&2 echo -e "${*}"
|
||||
}
|
||||
|
||||
to_stdout() {
|
||||
echo -e "${*}"
|
||||
}
|
||||
|
||||
error() {
|
||||
to_stderr " ${red}×${nc} ${*}"
|
||||
}
|
||||
|
||||
warn() {
|
||||
to_stderr " ${yellow}⚠${nc} ${*}"
|
||||
}
|
||||
|
||||
info() {
|
||||
to_stdout " ${blue}i${nc} ${*}"
|
||||
}
|
||||
|
||||
debug() {
|
||||
if [ -n "${debug}" ]; then
|
||||
to_stderr " ${dim}▶ ${*}${nc}"
|
||||
fi
|
||||
}
|
||||
|
||||
success() {
|
||||
to_stdout " ${green}✓${nc} ${*}"
|
||||
}
|
||||
|
||||
trace() {
|
||||
to_stderr "Stacktrace:"
|
||||
|
||||
local i=1 line file func
|
||||
while read -r line func file < <(caller ${i}); do
|
||||
to_stderr "[${i}] ${file}:${line} ${func}(): $(sed -n "${line}p" "${file}")"
|
||||
((i++))
|
||||
done
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2120
|
||||
die() {
|
||||
if [ "${#}" -gt 0 ]; then
|
||||
error "${*}"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
needs_arg() {
|
||||
if [ -z "${OPTARG}" ]; then
|
||||
>&2 echo "${0}: option requires an argument -- ${OPT}"
|
||||
usage
|
||||
die
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo
|
||||
echo "Template script."
|
||||
echo
|
||||
to_stdout "${bld}Usage:${nc}"
|
||||
to_stdout " ${dim}\$${nc} ${script_name}"
|
||||
echo
|
||||
to_stdout "${bld}Options:${nc}"
|
||||
cat <<EOF | column -tds '|'
|
||||
-e, --error|Exit with error
|
||||
-o, --option|Some option
|
||||
-d, --debug|Enable debug output
|
||||
-h, --help|Show this help message
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
while getopts 'hdeo:-:' OPT; do
|
||||
# support long options: https://stackoverflow.com/a/28466267/519360
|
||||
if test "$OPT" = "-"; then # long option: reformulate OPT and OPTARG
|
||||
OPT="${OPTARG%%=*}" # extract long option name
|
||||
# shellcheck disable=SC2295
|
||||
OPTARG="${OPTARG#$OPT}" # extract long option argument (may be empty)
|
||||
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=`
|
||||
fi
|
||||
|
||||
# Handle flags
|
||||
case "$OPT" in
|
||||
e | error )
|
||||
die "exited with error"
|
||||
;;
|
||||
o | option )
|
||||
needs_arg
|
||||
OPTION="${OPTARG}"
|
||||
;;
|
||||
d | debug )
|
||||
debug=true
|
||||
;;
|
||||
h | help )
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
??* ) # bad long option
|
||||
>&2 echo "${0}: illegal option -- $OPT"
|
||||
usage
|
||||
die
|
||||
;;
|
||||
? ) # bad short option (error reported via getopts)
|
||||
usage
|
||||
die
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
debug "Start of main"
|
||||
echo "This is a template."
|
||||
|
||||
if [ -n "${OPTION}" ]; then
|
||||
debug "Option is not empty"
|
||||
echo "Option is set to: ${OPTION}"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1753749649,
|
||||
"narHash": "sha256-+jkEZxs7bfOKfBIk430K+tK9IvXlwzqQQnppC2ZKFj4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1f08a4df998e21f4e8be8fb6fbf61d11a1a5076a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-25.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
{
|
||||
description = "install-system package and shell environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }: let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
|
||||
name = builtins.baseNameOf (builtins.toString ./.);
|
||||
shellApplication = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
|
||||
text = builtins.readFile ./${name}.sh;
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
unixtools.column
|
||||
];
|
||||
};
|
||||
in {
|
||||
packages.x86_64-linux.default = shellApplication;
|
||||
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
packages = [ shellApplication ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e # Exit on error
|
||||
set +u # Allow unset variables
|
||||
set -o pipefail # Enable pipefail
|
||||
|
||||
script_name=$(basename "${0}")
|
||||
nc="\e[0m" # Unset styles
|
||||
bld="\e[1m" # Bold text
|
||||
dim="\e[2m" # Dim text
|
||||
red="\e[31m" # Red foreground
|
||||
green="\e[32m" # Green foreground
|
||||
yellow="\e[33m" # Yellow foreground
|
||||
blue="\e[34m" # Blue foreground
|
||||
|
||||
to_stderr() {
|
||||
>&2 echo -e "${*}"
|
||||
}
|
||||
|
||||
to_stdout() {
|
||||
echo -e "${*}"
|
||||
}
|
||||
|
||||
error() {
|
||||
to_stderr " ${red}×${nc} ${*}"
|
||||
}
|
||||
|
||||
warn() {
|
||||
to_stderr " ${yellow}⚠${nc} ${*}"
|
||||
}
|
||||
|
||||
info() {
|
||||
to_stdout " ${blue}i${nc} ${*}"
|
||||
}
|
||||
|
||||
debug() {
|
||||
if [ -n "${debug}" ]; then
|
||||
to_stderr " ${dim}▶ ${*}${nc}"
|
||||
fi
|
||||
}
|
||||
|
||||
success() {
|
||||
to_stdout " ${green}✓${nc} ${*}"
|
||||
}
|
||||
|
||||
trace() {
|
||||
to_stderr "Stacktrace:"
|
||||
|
||||
local i=1 line file func
|
||||
while read -r line func file < <(caller ${i}); do
|
||||
to_stderr "[${i}] ${file}:${line} ${func}(): $(sed -n "${line}p" "${file}")"
|
||||
((i++))
|
||||
done
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2120
|
||||
die() {
|
||||
if [ "${#}" -gt 0 ]; then
|
||||
error "${*}"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
needs_arg() {
|
||||
if [ -z "${OPTARG}" ]; then
|
||||
to_stderr "${0}: option requires an argument -- ${OPT}"
|
||||
usage
|
||||
die
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
to_stdout
|
||||
to_stdout "NixOS installation helper script."
|
||||
to_stdout
|
||||
to_stdout "${bld}Usage:${nc}"
|
||||
to_stdout " ${dim}\$${nc} ${script_name}"
|
||||
to_stdout
|
||||
to_stdout "${bld}Options:${nc}"
|
||||
cat <<EOF | column -tds '|'
|
||||
-e, --error|Exit with error
|
||||
-o, --option|Some option
|
||||
-d, --debug|Enable debug output
|
||||
-h, --help|Show this help message
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
while getopts 'hdeo:-:' OPT; do
|
||||
# support long options: https://stackoverflow.com/a/28466267/519360
|
||||
if test "$OPT" = "-"; then # long option: reformulate OPT and OPTARG
|
||||
OPT="${OPTARG%%=*}" # extract long option name
|
||||
# shellcheck disable=SC2295
|
||||
OPTARG="${OPTARG#$OPT}" # extract long option argument (may be empty)
|
||||
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=`
|
||||
fi
|
||||
|
||||
# Handle flags
|
||||
case "$OPT" in
|
||||
e | error )
|
||||
die "exited with error"
|
||||
;;
|
||||
o | option )
|
||||
needs_arg
|
||||
OPTION="${OPTARG}"
|
||||
;;
|
||||
d | debug )
|
||||
debug=true
|
||||
;;
|
||||
h | help )
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
??* ) # bad long option
|
||||
>&2 echo "${0}: illegal option -- $OPT"
|
||||
usage
|
||||
die
|
||||
;;
|
||||
? ) # bad short option (error reported via getopts)
|
||||
usage
|
||||
die
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
debug "Start of main"
|
||||
info "This is a template."
|
||||
|
||||
if [ -n "${OPTION}" ]; then
|
||||
debug "Option is not empty"
|
||||
debug "Option is set to: ${OPTION}"
|
||||
fi
|
||||
}
|
||||
|
||||
main "${@}"
|
||||
Loading…
Reference in New Issue