Created basic NixOS and home-manager flake

This commit is contained in:
Bo⋆˚✿˖° 2025-09-01 13:36:09 +02:00
parent 17687db113
commit 06e98520af
9 changed files with 420 additions and 0 deletions

49
flake.lock generated Normal file
View file

@ -0,0 +1,49 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1756679287,
"narHash": "sha256-Xd1vOeY9ccDf5VtVK12yM0FS6qqvfUop8UQlxEB+gTQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "07fc025fe10487dd80f2ec694f1cd790e752d0e8",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.05",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1756617294,
"narHash": "sha256-aGnd4AHIYCWQKChAkHPpX+YYCt7pA6y2LFFA/s8q0wQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b4c2c57c31e68544982226d07e4719a2d86302a8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

50
flake.nix Normal file
View file

@ -0,0 +1,50 @@
{
description = "Bo's NixOS flake :]";
inputs = {
# This flake is currently set to use the latest stable branche of nixpkgs, this being 25.05
# Use `nix flake update` to update to the latest commit on the branche given below
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
# Use home-manager and make home-manager pull its packages from nixpkgs (input entered above)
home-manager = {
url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, ... }: {
nixosConfigurations = {
# Orchid is the name given for workstation installs
# Use `nixos-rebuild switch --flake .#Orchid` to build for this configuration
Orchid = nixpkgs.lib.nixosSystem {
modules =
[
./hosts/default.nix # Global default configuration
./hosts/Orchid/configuration.nix # Machine-specific configuration
# Other modules
./modules/nixos/kde.nix
#./modules/nixos/gnome.nixlib
# Imports home-manager
inputs.home-manager.nixosModules.default {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.bo = import ./hosts/Orchid/home.nix;
}
];
};
# Moonlight is the name given for server installs
# Use `nixos-rebuild switch --flake .#Moonlight` to build for this configuration
Neptune = {
modules = [ ./hosts/Moonlight/configuration.nix ];
};
};
};
}

View file

@ -0,0 +1,111 @@
{ config, pkgs, inputs, ... }:
{
imports =
[
./hardware-configuration.nix
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Enables the systemd bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# We'll be using the latest kernel (who needs reliability anyway?) :3
boot.kernelPackages = pkgs.linuxPackages_latest;
# Enables NetworkManager
networking.networkmanager.enable = true;
# Sets the hostname (the name of your computer)
networking.hostName = "Orchid";
# Uncomment this to add firewall exceptions
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or uncomment this to disable the firewall all together (don't do it)
# networking.firewall.enable = false;
# Sets the timezone
time.timeZone = "Europe/Amsterdam";
# Sets some default localization
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
useXkbConfig = true;
};
services.xserver = {
xkb.layout = "us";
xkb.variant = "intl";
#xkb.options = "grp:win_space_toggle";
};
# Enables printing suport through CUPS
services.printing.enable = true;
# Enables bluetooth
hardware.bluetooth.enable = true;
# Enables sound through pipewire
services.pipewire = {
enable = true;
pulse.enable = true;
};
# Enables the GPG agent
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Uncomment this to enable the openssh daemon
# services.openssh.enable = true;
# Adds core GUI apps available to everyone
environment.systemPackages = with pkgs; [
firefox
];
# Enables Docker support
virtualisation.docker.enable = true;
# Comment if you're not using btrfs
virtualisation.docker.storageDriver = "btrfs";
# ======================
# USER SPECIFIC SETTINGS
# ======================
# Enables fish as my shell :3
programs.fish.enable = true;
# Sets up syncthing for Library syncthing
#services.syncthing = {
# enable = true;
# user = "bo";
#};
# Don't forget to set a password with passwd
users.users.bo = {
isNormalUser = true;
description = "Bo Jordans";
home = "/home/bo";
initialPassword = "meow";
extraGroups = [ "docker" "wheel" ]; # Enable sudo for the user
shell = pkgs.fish;
openssh.authorizedKeys.keys = [
];
};
# ====================
# END OF USER SETTINGS
# ====================
# DO NOT CHANGE THIS VALUE
# This value does not change the branche your system is on, to do that please check flake.nix
# This value just indicates which version the config file was originally made for
system.stateVersion = "25.05"; # Did you read the comment?
}

View file

@ -0,0 +1,21 @@
function fish_greeting
if not set -q fish_greeting
set -l line1 (_ ':3')
set -g fish_greeting "$line1"
end
if set -q fish_private_mode
set -l line (_ "fish is running in private mode, history will not be persisted.")
if set -q fish_greeting[1]
set -g fish_greeting $fish_greeting\n$line
else
set -g fish_greeting $line
end
end
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
# Keep it that way to not print superfluous newlines on old configuration
test -n "$fish_greeting"
and echo $fish_greeting
end

View file

@ -0,0 +1,63 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
# Import kernel modules
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# Partition map for Orchid
#NAME SIZE TYPE MOUNTPOINTS LABEL FILESYSTEM
#sda 238.5G disk
#├─sda1 512M part /boot BOOT vfat
#└─sda2 REST part NixOS luks2
# └─Orchid REST crypt / Orchid btrfs
# /nix
# /home
# Label of the luks2 partition
boot.initrd.luks.devices."Orchid".device = "/dev/disk/by-label/NixOS";
# Declares all filesystems
fileSystems."/" =
{ device = "/dev/disk/by-label/Orchid";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-label/Orchid";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-label/Orchid";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
# You can declare swap devices down below
swapDevices = [ ];
# This option enables DHCP for all interfaces
# It is recommended to declare this for each individual interface, but it shouldn't hurt keeping it like this
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
# Declare the default host platform and microcode for intel cpus (amd is missing!)
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

97
hosts/Orchid/home.nix Normal file
View file

@ -0,0 +1,97 @@
{ config, pkgs, lib, ... }:
let
catppuccin-fish = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "fish";
rev = "6a85af2ff722ad0f9fbc8424ea0a5c454661dfed";
sha256 = "1h0nn1kg1vs0xilmai5haw42sm7wfs0b6jq2xpaq48qlfad1xk9r";
};
in
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "bo";
home.homeDirectory = "/home/bo";
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
vlc
krita
gimp
kdePackages.kdenlive
hyfetch
fastfetch
htop
btop
];
# Enables the GPG agent
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
};
# Enables git and enters name and email
programs.git = {
enable = true;
userName = "Bo Jordans";
userEmail = "bojordans@pixelated.sh";
};
# Enables fish as my shell :3
programs.fish.enable = true;
# Here you declare your dotfiles and where they need to go
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
".config/fish/themes/Catppuccin Frappe.theme".source = "${catppuccin-fish}/themes/Catppuccin Frappe.theme";
};
# Here you set all variables for your shell :]
home.sessionVariables = {
EDITOR = "vim";
};
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "25.05"; # Please read the comment before changing.
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

11
hosts/default.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
# List of basic packages to be installed system wide
# Use https://search.nixos.org/ to find more packages (and options)
environment.systemPackages = with pkgs; [
vim
wget
htop
];
}

7
modules/nixos/gnome.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
# Enables the GNOME DE and GDM DM
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
}

11
modules/nixos/kde.nix Normal file
View file

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
# Enables the Plasma 6 DE and the SDDM DM with Wayland
services.desktopManager.plasma6.enable = true;
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
enableHidpi = true;
};
}