feat: restructure flake into multi-host setup 🎨
This commit is contained in:
parent
bd98e17460
commit
14bdd2db85
4 changed files with 365 additions and 22 deletions
137
nixos/flake.lock
generated
137
nixos/flake.lock
generated
|
|
@ -1,23 +1,144 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1738078788,
|
"lastModified": 1747046372,
|
||||||
"narHash": "sha256-QyCJLV1v8ECVr/e2UVt+4atWHi9aTPUAhPjW3hW0Ja0=",
|
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
|
||||||
"owner": "nixos",
|
"owner": "edolstra",
|
||||||
"repo": "nixpkgs",
|
"repo": "flake-compat",
|
||||||
"rev": "3dad8067aba6ecb98a1869c775dab7fef3a51dd1",
|
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681202837,
|
||||||
|
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixos-wsl": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1753450337,
|
||||||
|
"narHash": "sha256-l0QLEenVKuU6U2g1wI0zuf9IAm7QpisIbf8wAI6BUX4=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "NixOS-WSL",
|
||||||
|
"rev": "a8dfcd2962f6e788759a75b36ca86b14aa44d8e5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "main",
|
||||||
|
"repo": "NixOS-WSL",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751792365,
|
||||||
|
"narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1753429684,
|
||||||
|
"narHash": "sha256-9h7+4/53cSfQ/uA3pSvCaBepmZaz/dLlLVJnbQ+SJjk=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "7fd36ee82c0275fb545775cc5e4d30542899511d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1682134069,
|
||||||
|
"narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "fd901ef4bf93499374c5af385b2943f5801c0833",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixos-wsl": "nixos-wsl",
|
||||||
|
"nixpkgs": "nixpkgs_2",
|
||||||
|
"vscode-server": "vscode-server"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vscode-server": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs_3"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1753541826,
|
||||||
|
"narHash": "sha256-foGgZu8+bCNIGeuDqQ84jNbmKZpd+JvnrL2WlyU4tuU=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixos-vscode-server",
|
||||||
|
"rev": "6d5f074e4811d143d44169ba4af09b20ddb6937d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixos-vscode-server",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,51 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs";
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
||||||
|
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
||||||
|
# for later
|
||||||
|
# home-manager.url = "github:nix-community/home-manager";
|
||||||
|
# home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs }: {
|
outputs = {
|
||||||
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
|
nixpkgs,
|
||||||
|
nixos-wsl,
|
||||||
|
vscode-server,
|
||||||
|
self,
|
||||||
|
# home-manager,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
nixosConfigurations = {
|
||||||
|
|
||||||
|
wsl = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
./configuration.nix
|
nixos-wsl.nixosModules.default
|
||||||
./hardware-configuration.nix
|
vscode-server.nixosModules.default
|
||||||
# ./uxplay.nix
|
./hosts/wsl.nix # previously configuration.nix
|
||||||
./fish.nix
|
./tmux.nix
|
||||||
./neovim.nix
|
./neovim.nix
|
||||||
|
./fish.nix
|
||||||
|
# home-manager.nixosModules.default
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
macbookair = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
vscode-server.nixosModules.default
|
||||||
|
./hosts/macbookair.nix # previously configuration.nix
|
||||||
|
./hardware-configuration.nix
|
||||||
|
./tmux.nix
|
||||||
|
./neovim.nix
|
||||||
|
./fish.nix
|
||||||
|
# home-manager.nixosModules.default
|
||||||
|
# ./configuration.nix # shouldn't this be necessary???
|
||||||
|
# ./uxplay.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
189
nixos/hosts/macbookair.nix
Normal file
189
nixos/hosts/macbookair.nix
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
# Edit this configuration file to define what should be installed on
|
||||||
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Bootloader.
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
boot.initrd.luks.devices."luks-04715655-635c-46ee-8100-1a5a4f3700a5".device = "/dev/disk/by-uuid/04715655-635c-46ee-8100-1a5a4f3700a5";
|
||||||
|
networking.hostName = "nixos"; # Define your hostname.
|
||||||
|
# NOTE: You can not use networking.networkmanager with networking.wireless
|
||||||
|
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||||
|
|
||||||
|
nix.settings.experimental-features = [ "nix-command" "flakes" ]; # for vscode remote server
|
||||||
|
|
||||||
|
# Configure network proxy if necessary
|
||||||
|
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||||
|
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||||
|
|
||||||
|
# Enable networking
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
# Set your time zone.
|
||||||
|
time.timeZone = "Europe/Copenhagen";
|
||||||
|
|
||||||
|
# Select internationalisation properties.
|
||||||
|
i18n.defaultLocale = "en_DK.UTF-8";
|
||||||
|
|
||||||
|
i18n.extraLocaleSettings = {
|
||||||
|
LC_ADDRESS = "da_DK.UTF-8";
|
||||||
|
LC_IDENTIFICATION = "da_DK.UTF-8";
|
||||||
|
LC_MEASUREMENT = "da_DK.UTF-8";
|
||||||
|
LC_MONETARY = "da_DK.UTF-8";
|
||||||
|
LC_NAME = "da_DK.UTF-8";
|
||||||
|
LC_NUMERIC = "da_DK.UTF-8";
|
||||||
|
LC_PAPER = "da_DK.UTF-8";
|
||||||
|
LC_TELEPHONE = "da_DK.UTF-8";
|
||||||
|
LC_TIME = "da_DK.UTF-8";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable the X11 windowing system.
|
||||||
|
services.xserver.enable = true;
|
||||||
|
|
||||||
|
# Enable the KDE Plasma Desktop Environment.
|
||||||
|
services.displayManager.sddm.enable = true;
|
||||||
|
services.xserver.desktopManager.plasma5.enable = true;
|
||||||
|
|
||||||
|
# Configure keymap in X11
|
||||||
|
services.xserver = {
|
||||||
|
xkb.layout = "us";
|
||||||
|
xkb.variant = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.nix-ld.enable = true;
|
||||||
|
# TODO: move to home manager (?)
|
||||||
|
programs = {
|
||||||
|
direnv = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
nix-direnv.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable CUPS to print documents.
|
||||||
|
services.printing.enable = true;
|
||||||
|
|
||||||
|
# Enable sound with pipewire.
|
||||||
|
services.pulseaudio.enable = false;
|
||||||
|
hardware.alsa.enable = false;
|
||||||
|
security.rtkit.enable = true;
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
alsa.support32Bit = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
# If you want to use JACK applications, uncomment this
|
||||||
|
#jack.enable = true;
|
||||||
|
|
||||||
|
# use the example session manager (no others are packaged yet so this is enabled by default,
|
||||||
|
# no need to redefine it in your config for now)
|
||||||
|
#media-session.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable touchpad support (enabled default in most desktopManager).
|
||||||
|
# services.xserver.libinput.enable = true;
|
||||||
|
|
||||||
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
|
users.users.dth = {
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "dth";
|
||||||
|
extraGroups = [ "networkmanager" "wheel" ];
|
||||||
|
# TODO: use home manager to define user packages
|
||||||
|
packages = with pkgs; [
|
||||||
|
vlc # video player
|
||||||
|
kate # editor
|
||||||
|
ripgrep # faster grep
|
||||||
|
nextcloud-client # private cloud
|
||||||
|
# thunderbird # bloat
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Install firefox.
|
||||||
|
programs.firefox.enable = true;
|
||||||
|
|
||||||
|
# install kde partition manager
|
||||||
|
programs.partition-manager.enable = true;
|
||||||
|
|
||||||
|
# TODO: install gnome disk manager
|
||||||
|
# programs.gnome-disks.enable = true;
|
||||||
|
|
||||||
|
# Allow unfree packages
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
# List packages installed in system profile. To search, run:
|
||||||
|
# $ nix search wget
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
|
||||||
|
# tmux # activated in tmux.nix
|
||||||
|
# vim # using neovim in stead
|
||||||
|
# neovim # activated in neovim.nix
|
||||||
|
|
||||||
|
git # version control
|
||||||
|
gh # github cli tool
|
||||||
|
|
||||||
|
ripgrep # faster grep
|
||||||
|
busybox # useful programs e.g. tree, unzip etc
|
||||||
|
openssl # cryptography swiss army knife
|
||||||
|
xdg-utils # terminal desktop intergrations (i.e. allow terminal to open browser)
|
||||||
|
xclip # terminal clipboard integration (i.e. allow terminal to r/w clipboard)
|
||||||
|
|
||||||
|
neofetch # system info
|
||||||
|
btop # resource monitor
|
||||||
|
wget # downloader
|
||||||
|
tldr # community driven manpage alternative
|
||||||
|
|
||||||
|
ntfs3g # mount NTFS drives on linux
|
||||||
|
gptfdisk # formatting drives - like fdisk but better
|
||||||
|
# this stuff runs gparted
|
||||||
|
|
||||||
|
# gimp # bloat image editing
|
||||||
|
# blender # bloat 3D modelling
|
||||||
|
# inkscape # bloat vecor graphics / drawing
|
||||||
|
# kdenlive # bloat video editor
|
||||||
|
|
||||||
|
# desktop applications
|
||||||
|
thunderbird # email / calendar
|
||||||
|
telegram-desktop # instant messager
|
||||||
|
|
||||||
|
cowsay
|
||||||
|
lolcat
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
# firefox smooth scrolling
|
||||||
|
environment.sessionVariables = {
|
||||||
|
MOZ_USE_XINPUT2 = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Some programs need SUID wrappers, can be configured further or are
|
||||||
|
# started in user sessions.
|
||||||
|
# programs.mtr.enable = true;
|
||||||
|
# programs.gnupg.agent = {
|
||||||
|
# enable = true;
|
||||||
|
# enableSSHSupport = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# List services that you want to enable:
|
||||||
|
|
||||||
|
# Enable the OpenSSH daemon.
|
||||||
|
# services.openssh.enable = true;
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
# networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# This value determines the NixOS release from which the default
|
||||||
|
# settings for stateful data, like file locations and database versions
|
||||||
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
# this value at the release version of the first install of this system.
|
||||||
|
# Before changing this value read the documentation for this option
|
||||||
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
|
system.stateVersion = "23.11"; # Did you read the comment?
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
Rebuild nixos and points to dotfiles dir:
|
Rebuild nixos and points to dotfiles dir:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo nixos-rebuild switch --flake ~/dotfiles/nixos#macbook
|
sudo nixos-rebuild switch --flake ~/dotfiles/nixos#macbookair
|
||||||
# or
|
# or
|
||||||
sudo nixos-rebuild switch --flake ~/dotfiles/nixos#wsl
|
sudo nixos-rebuild switch --flake ~/dotfiles/nixos#wsl
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue