feat: add template
Some checks failed
Check flake / check (push) Has been cancelled

This commit is contained in:
Youwen Wu 2024-12-26 00:46:15 -08:00
parent 512b0e3aa1
commit 3372af8c03
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
6 changed files with 238 additions and 5 deletions

View file

@ -6,17 +6,19 @@ based on [NixOS](https://nixos.org/).
Time wasted writing Nix code: Time wasted writing Nix code:
![](https://wakatime.com/badge/user/018dc5b8-ba5a-4572-a38a-b526d1b28240/project/c59b3d5e-0c9c-4bd5-a752-e75522ab0cdc.svg) + [![wakatime](https://wakatime.com/badge/user/018dc5b8-ba5a-4572-a38a-b526d1b28240/project/de5e82f8-8a09-42cb-ae45-9c80f2ab5a41.svg)](https://wakatime.com/badge/user/018dc5b8-ba5a-4572-a38a-b526d1b28240/project/de5e82f8-8a09-42cb-ae45-9c80f2ab5a41) ![](https://wakatime.com/badge/user/018dc5b8-ba5a-4572-a38a-b526d1b28240/project/c59b3d5e-0c9c-4bd5-a752-e75522ab0cdc.svg) + [![wakatime](https://wakatime.com/badge/user/018dc5b8-ba5a-4572-a38a-b526d1b28240/project/de5e82f8-8a09-42cb-ae45-9c80f2ab5a41.svg)](https://wakatime.com/badge/user/018dc5b8-ba5a-4572-a38a-b526d1b28240/project/de5e82f8-8a09-42cb-ae45-9c80f2ab5a41)
This repository implements a NixOS module that declares the entire liminalOS This repository exposes a NixOS module that declares the entire liminalOS
operating system. It aims to be an easy way to both set up a brand new system operating system. It aims to be an easy way to both set up a brand new system
with my opinionated configurations, and also inject into an existing NixOS with my opinionated configurations, and also inject into an existing NixOS
configuration. configuration.
A reference implementation of liminalOS on actual working systems is in Reference implementations of liminalOS on actual working systems is in
[./reference](./reference). [./reference](./reference).
liminalOS is currently in a heavily experimental state, and cannot be consumed liminalOS is currently in a heavily experimental state, but it is used in
directly without much prior work. Development is ongoing to create a fully production every day!
self-contained module.
You can try it with `nix flake init -t github:youwen5/liminalOS#liminalOS`,
which will create a sample configuration flake along with corresponding files.
Many have written at length about the virtues of NixOS and _declarative Many have written at length about the virtues of NixOS and _declarative
configuration_ and _immutability_ and such. I doubt what I have to say is configuration_ and _immutability_ and such. I doubt what I have to say is

View file

@ -189,6 +189,14 @@
]; ];
}; };
}; };
templates = rec {
liminalOS = {
path = ./templates/liminalOS;
description = "Barebones configuration of liminalOS";
};
default = liminalOS;
};
}; };
perSystem = perSystem =
{ {

View file

@ -0,0 +1,106 @@
# 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).
{
pkgs,
inputs,
...
}:
{
imports = [
# Important: you should replace hardware-configuration.nix with your actual
# hardware-configuration.nix generated during NixOS installation, located
# at /etc/nixos/hardware-configuration.nix! If you don't have this file,
# re-run nixos-install to generate it.
./hardware-configuration.nix
];
networking.hostName = "liminalOS"; # Define your hostname.
liminalOS = {
# Set this to the absolute path of the location of this configuration flake
# to enable some UX enhanacements
flakeLocation = null;
config.allowUnfree = true;
# Set your default editor to any program.
defaultEditor = pkgs.helix;
# Set to either "laptop" or "desktop" for some adjustments
formFactor = "desktop";
# Set a wallpaper to whatever you want! You can use a local path as well.
# The colorscheme for the system is automatically generated from this
# wallpaper!
theming = {
wallpaper = pkgs.fetchurl {
url = "https://w.wallhaven.cc/full/l8/wallhaven-l8x1pr.jpg";
hash = "sha256-Ts8igtDxLsnAnpy+tiGAXVhJWYLMHGOb2fd8lpV+UnM=";
};
};
system = {
# Toggle true to enable audio production software, like reaper, and yabridge + 64 bit wine for
# installing Windows-exclusive VSTs!
audio.prod.enable = false;
networking = {
# Toggle on to allow default vite ports of 5173 and 4173 through the firewall for local testing!
firewallPresets.vite = false;
# Use cloudflare's 1.1.1.1 DNS servers
cloudflareNameservers.enable = true;
};
graphics.nvidia.enable = true;
};
extras.gaming = {
# Enable gaming utilities, like Heroic, Lutris, Steam
enable = true;
# Installs Roblox using Sober, as a flatpak. Note that this will enable
# the impure flatpak service that automatically updates flatpaks every
# week upon nixos-rebuild switch
roblox.enable = true;
utilities.gamemode = {
# enable the gamemoderun binary to maximize gaming performance
enable = true;
# don't forget to update this if you change your username!
gamemodeUsers = [ "default-user" ];
};
};
};
# Set up a user
users.users.default-user = {
isNormalUser = true;
description = "Default liminalOS user!";
extraGroups = [
"networkmanager"
"wheel"
];
shell = pkgs.fish;
};
home-manager.users.default-user = {
imports = [ ./home.nix ];
};
home-manager.extraSpecialArgs = { inherit inputs; };
# Set your time zone
time.timeZone = "America/Los_Angeles";
# Bootloader and kernel.
boot = {
loader = {
efi.canTouchEfiVariables = true;
timeout = 15;
systemd-boot = {
enable = true;
};
};
kernelPackages = pkgs.linuxPackages_zen;
};
# 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. Its 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 = "24.05"; # Did you read the comment?
}

View file

@ -0,0 +1,33 @@
{
description = "Test standalone liminalOS system";
inputs = {
# Follow the nixpkgs in liminalOS, which is verified to build properly before release.
nixpkgs.follows = "liminalOS/nixpkgs";
liminalOS.url = "github:youwen5/liminalOS/modules-refactor";
# Alternatively, pin your own nixpkgs and set liminalOS to follow it, as shown below.
# nixpkgs.follows = "github:nixos/nixpkgs?ref=nixos-unstable";
# liminalOS.url = "github:youwen5/liminalOS/modules-refactor";
# liminalOS.inputs.nixpkgs.follows = "nixpkgs";
# Either way, you should ensure that liminalOS shares nixpkgs with your
# system to avoid any weird conflicts.
};
outputs =
inputs@{ nixpkgs, liminalOS, ... }:
{
# Execute sudo nixos-rebuild switch --flake .#liminalOS
nixosConfigurations = {
liminalOS = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
liminalOS.nixosModules.default
./configuration.nix
];
};
};
};
}

View file

@ -0,0 +1,59 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/5a339a7f-8668-42d7-9ecc-d7a8f1d3f7b2";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-362ec972-7c5e-4c9f-ba5d-b8f2ed083509".device =
"/dev/disk/by-uuid/362ec972-7c5e-4c9f-ba5d-b8f2ed083509";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/27EE-D950";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
swapDevices = [
{ device = "/dev/disk/by-uuid/670fc084-d593-44b3-aed9-78d95fec71de"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp6s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,25 @@
{ inputs, ... }:
{
imports = [
# import the liminalOS home manager module
inputs.liminalOS.homeManagerModules.default
];
home = {
username = "default-user";
homeDirectory = "/home/default-user";
};
liminalOS = {
# Enable the easyeffects program to easily EQ your headphones and add
# microphone effects
utils.easyeffects.enable = true;
};
programs.git = {
userName = "Default User";
userEmail = "default@localhost";
};
home.stateVersion = "24.05";
}