From 2c6d70230fc7d641c19110828128ba6f3c41745e Mon Sep 17 00:00:00 2001 From: Minijackson Date: Sun, 4 Jul 2021 09:20:05 +0200 Subject: flake: add default/desktop template --- flake.nix | 9 +++++++++ templates/desktop/boot.nix | 10 ++++++++++ templates/desktop/flake.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++ templates/desktop/host.nix | 11 +++++++++++ templates/desktop/tinc.nix | 16 +++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 templates/desktop/boot.nix create mode 100644 templates/desktop/flake.nix create mode 100644 templates/desktop/host.nix create mode 100644 templates/desktop/tinc.nix diff --git a/flake.nix b/flake.nix index 36df331..befc158 100644 --- a/flake.nix +++ b/flake.nix @@ -194,6 +194,15 @@ }; }; + templates = { + desktop = { + path = ./templates/desktop; + description = "Flake template for a new desktop machine"; + }; + }; + + defaultTemplate = self.templates.desktop; + hydraJobs = let # Use the nixpkgs configuration of the testDefault machine, so that it diff --git a/templates/desktop/boot.nix b/templates/desktop/boot.nix new file mode 100644 index 0000000..ad4a186 --- /dev/null +++ b/templates/desktop/boot.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + boot.loader.systemd-boot = { + enable = true; + editor = false; + }; + + boot.cleanTmpDir = true; +} diff --git a/templates/desktop/flake.nix b/templates/desktop/flake.nix new file mode 100644 index 0000000..e0b2e40 --- /dev/null +++ b/templates/desktop/flake.nix @@ -0,0 +1,47 @@ +{ + description = "Flake for the myHostname host"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05"; + inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs"; + inputs.nixos-config-reborn = { + url = "git+https://git.huh.gdn/NixOS/nixos-config-reborn"; + inputs = { + nixpkgs.follows = "nixpkgs"; + nixpkgs-unstable.follows = "nixpkgs-unstable"; + }; + }; + inputs.nixos-hardware.url = "github:NixOS/nixos-hardware"; + + outputs = inputs @ { self, nixpkgs, nixos-config-reborn, nixos-hardware, ... }: { + + nixosConfigurations.myHostname = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = (with nixos-hardware.nixosModules; [ + common-cpu-intel + common-pc-ssd + ]) ++ (with nixos-config-reborn.nixosModules; [ + default + profiles.desktop + + usecases.desktop.development + usecases.desktop.graphical.gaming + usecases.desktop.graphical.kodi + usecases.desktop.networkManager + ]) ++ [ + ./hardware-configuration.nix + + ./boot.nix + ./host.nix + ./tinc.nix + + ({ ... }: { + home-manager.users.minijackson.home.stateVersion = "21.05"; + home-manager.users.root.home.stateVersion = "21.05"; + + system.stateVersion = "21.05"; + }) + ]; + }; + + }; +} diff --git a/templates/desktop/host.nix b/templates/desktop/host.nix new file mode 100644 index 0000000..e775db8 --- /dev/null +++ b/templates/desktop/host.nix @@ -0,0 +1,11 @@ +{ config, ... }: + +{ + networking.hostName = "myHostname"; + + theme.colors = with config.theme.colors; { + dominantName = "green"; + dominant = neutralGreen; + dimDominant = fadedGreen; + }; +} diff --git a/templates/desktop/tinc.nix b/templates/desktop/tinc.nix new file mode 100644 index 0000000..9f4b365 --- /dev/null +++ b/templates/desktop/tinc.nix @@ -0,0 +1,16 @@ +{ config, ... }: + +{ + topology.mainVpn = { + currentNodeIP = ""; + }; + + networking.interfaces."${config.topology.mainVpn.interfaceName}" = { + virtual = true; + virtualType = "tun"; + ipv6.addresses = [ { + address = config.topology.mainVpn.currentNodeIP; + prefixLength = 64; + } ]; + }; +} -- cgit v1.2.3