Compare commits

..

9 commits

9 changed files with 129 additions and 21 deletions

1
.envrc
View file

@ -1,3 +1,4 @@
#! /usr/bin/env bash
# make this point to wherever your own es25519 ssh key is # make this point to wherever your own es25519 ssh key is
SOPS_AGE_KEY=$(ssh-to-age -i ~/.ssh/id_ed25519 -private-key) SOPS_AGE_KEY=$(ssh-to-age -i ~/.ssh/id_ed25519 -private-key)
export SOPS_AGE_KEY export SOPS_AGE_KEY

View file

@ -4,22 +4,34 @@ from pathlib import Path
import subprocess import subprocess
from socket import gethostname from socket import gethostname
import colors import colors
from typing import Mapping
def format_link(link: str, text: str) -> str: def format_link(link: str, text: str) -> str:
return f"\033]8;;{link}\033\\{text}\033]8;;\033\\" return f"\033]8;;{link}\033\\{text}\033]8;;\033\\"
def run(cmd: list[str], cwd: Path = Path.cwd(), exit_on_error: bool = True, **kwargs) -> subprocess.CompletedProcess: def get_environment() -> dict[str, str]:
env = dict(environ)
env["DIRENV_DISABLE"] = "1"
return env
def run(cmd: list[str], cwd: Path = Path.cwd(), exit_on_error: bool = True, env: dict[str, str] | None = None, **kwargs) -> subprocess.CompletedProcess:
if not env:
env = get_environment()
c = colors.Colors c = colors.Colors
print(f"{c.GREEN}Running command: {c.PURPLE}'{' '.join(cmd)}'{c.END}") print(f"{c.GREEN}Running command: {c.PURPLE}'{' '.join(cmd)}'{c.END}")
if cwd != Path.cwd(): if cwd != Path.cwd():
print(f"{c.GREEN} 󱞩 in directory: {c.YELLOW}'{format_link(link="file://" + str(cwd), text=cwd)}'{c.END}") print(f"{c.GREEN} 󱞩 in directory: {c.YELLOW}'{format_link(link="file://" + str(cwd), text=cwd)}'{c.END}")
result = subprocess.run(cmd, cwd=cwd, check=False, **kwargs)
result = subprocess.run(cmd, cwd=cwd, check=False, env=env, **kwargs)
if result.returncode != 0: if result.returncode != 0:
print(f"{c.RED}Command exited with non-zero exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}") print(f"{c.RED}Command exited with non-zero exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}")
if exit_on_error is True: if exit_on_error is True:
result.check_returncode() result.check_returncode()
else: else:
print(f"{c.GREEN}Command exited with exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}") print(f"{c.GREEN}Command exited with exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}")
return result return result
@aliases.register @aliases.register
@ -49,6 +61,13 @@ def _vm(args):
@aliases.register @aliases.register
def _upd(args: list): def _upd(args: list):
path = Path("/etc/nixos") path = Path("/etc/nixos")
possible_subcommands = ("switch", "boot")
subcommand = "switch"
for arg in args:
if arg in possible_subcommands:
subcommand = arg
args.remove(arg)
break
if path.exists(): if path.exists():
c = colors.Colors c = colors.Colors
files_to_delete = { files_to_delete = {
@ -57,7 +76,7 @@ def _upd(args: list):
} }
if not "--no-pull" in args: if not "--no-pull" in args:
print(f"{c.BLUE}Pulling {c.YELLOW}NixOS{c.BLUE} configuration from remote{c.END}") print(f"{c.BLUE}Pulling {c.YELLOW}NixOS{c.BLUE} configuration from remote{c.END}")
run["git", "pull", cwd=path] run(["git", "pull"], cwd=path)
else: else:
args.remove("--no-pull") args.remove("--no-pull")
if "--rewrite-hardware-configuration" in args: if "--rewrite-hardware-configuration" in args:
@ -84,7 +103,7 @@ def _upd(args: list):
args.append("--impure") args.append("--impure")
if "--impure" in args: if "--impure" in args:
print(f"{c.RED}WARNING: The --impure flag is set!{c.END}") print(f"{c.RED}WARNING: The --impure flag is set!{c.END}")
run(["sudo", "nixos-rebuild", "switch", *args], cwd=path) run(["sudo", "nixos-rebuild", subcommand, *args], cwd=path)
@aliases.register @aliases.register
def _lock(args): def _lock(args):

View file

@ -420,7 +420,9 @@ rec {
ru = true; ru = true;
}; };
"terminal.integrated.defaultProfile.linux" = "xonsh"; "terminal.integrated.defaultProfile.linux" = "xonsh";
"terminal.integrated.inheritEnv" = "true";
"explorer.confirmPasteNative" = false; "explorer.confirmPasteNative" = false;
"editor.formatOnSave" = true;
"editor.renderWhitespace" = "none"; "editor.renderWhitespace" = "none";
"explorer.fileNesting.patterns" = { "explorer.fileNesting.patterns" = {
"*.ts" = "\${capture}.js"; "*.ts" = "\${capture}.js";

View file

@ -1,7 +1,12 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ pkgs, config, hostname, ... }: {
pkgs,
config,
hostname,
...
}:
{ {
nix = { nix = {
settings = { settings = {
@ -18,10 +23,10 @@
# install the most recent stable linux kernel # install the most recent stable linux kernel
/* /*
TODO: change this back to 'pkgs.linuxPackages_latest' once TODO: change this back to 'pkgs.linuxPackages_latest' once
https://github.com/NixOS/nixpkgs/commit/c805021f3a95da44a1811f1235b997f57d893dc3 https://github.com/NixOS/nixpkgs/commit/c805021f3a95da44a1811f1235b997f57d893dc3
and https://github.com/NixOS/nixpkgs/pull/375838 and https://github.com/NixOS/nixpkgs/pull/375838
trickle down to nixos-unstable trickle down to nixos-unstable
*/ */
boot.kernelPackages = pkgs.linuxPackages_6_12; boot.kernelPackages = pkgs.linuxPackages_6_12;
@ -79,11 +84,11 @@
# Add /etc/current-system-packages # Add /etc/current-system-packages
environment.etc."current-system-packages".text = environment.etc."current-system-packages".text =
let let
packages = builtins.map (p: "${p.name}") config.environment.systemPackages; packages = builtins.map (p: "${p.name}") config.environment.systemPackages;
sortedUnique = builtins.sort builtins.lessThan (pkgs.lib.lists.unique packages); sortedUnique = builtins.sort builtins.lessThan (pkgs.lib.lists.unique packages);
formatted = builtins.concatStringsSep "\n" sortedUnique; formatted = builtins.concatStringsSep "\n" sortedUnique;
in in
formatted; formatted;
# Enable CUPS to print documents. # Enable CUPS to print documents.
@ -132,17 +137,27 @@
# programs.mtr.enable = true; # programs.mtr.enable = true;
programs.gnupg.agent = { programs.gnupg.agent = {
enable = true; enable = true;
enableSSHSupport = true; # enableSSHSupport = true;
enableExtraSocket = true; # VSCode devcontainers require this
};
programs.ssh = {
startAgent = true;
extraConfig = ''
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519
'';
}; };
# PAM modules # PAM modules
security.pam = { security.pam = {
loginLimits = [{ loginLimits = [
domain = "*"; {
type = "soft"; domain = "*";
item = "nofile"; type = "soft";
value = 8192; item = "nofile";
}]; value = 8192;
}
];
}; };
# List services that you want to enable: # List services that you want to enable:

View file

@ -10,6 +10,9 @@
programs.direnv = { programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
direnvrcExtra = ''
''${DIRENV_DISABLE:+exit}
'';
}; };
nix.extraOptions = '' nix.extraOptions = ''

View file

@ -58,6 +58,7 @@
ryujinx-greemdev ryujinx-greemdev
protonup-qt protonup-qt
winetricks winetricks
#(pkgs.callPackage ../packages/lucem.nix { inherit pkgs; })
vinegar # Roblox Studio, use Sober in ./flatpak.nix for the Roblox Player vinegar # Roblox Studio, use Sober in ./flatpak.nix for the Roblox Player
celeste64 celeste64
]; ];

View file

@ -52,6 +52,14 @@ in
programs.partition-manager.enable = true; programs.partition-manager.enable = true;
programs.kdeconnect.enable = true; programs.kdeconnect.enable = true;
programs.ssh = {
enableAskPassword = true;
askPassword = pkgs.lib.mkForce "${pkgs.ksshaskpass.out}/bin/ksshaskpass";
};
environment.variables = {
SSH_ASKPASS_REQUIRE = "prefer";
};
fonts = { fonts = {
enableDefaultPackages = true; enableDefaultPackages = true;
fontDir.enable = true; fontDir.enable = true;

View file

@ -74,6 +74,10 @@ in
# install docker # install docker
virtualisation.docker = { virtualisation.docker = {
enable = true; enable = true;
autoPrune = {
enable = true;
dates = "daily";
};
}; };
# remove nano # remove nano

55
packages/lucem.nix Normal file
View file

@ -0,0 +1,55 @@
{
pkgs,
lib,
...
}:
pkgs.stdenv.mkDerivation rec {
pname = "lucem";
version = "2.1.2";
src = pkgs.fetchFromGitHub {
owner = "xTrayambak";
repo = "lucem";
rev = version;
hash = "sha256-31EdtCQftxhpp2b7fpM5XqRh+r0rBE/k9SpYEPpGpV0=";
};
nativeBuildInputs = with pkgs; [
gtk4.dev
libadwaita.dev
pkg-config
openssl.dev
curl.dev
xorg.libX11
xorg.libXcursor.dev
xorg.libXrender
xorg.libXext
libxkbcommon
libGL.dev
wayland.dev
wayland-protocols
wayland-scanner.dev
nimble
];
buildPhase = ''
runHook preBuild
nimble build
runHook postBuild
'';
installPhase = ''
runHook preInstall
runHook postInstall
'';
meta = {
description = "An open-source bootstrapper for Sober, similar to Bloxstrap.";
homepage = "https://github.com/xTrayambak/lucem";
downloadPage = "https://github.com/xTrayambak/lucem/releases/tag/${version}";
license = lib.licenses.mit; # https://github.com/xTrayambak/lucem/blob/31f996b64edafba1d75e16130bcb14576a326ebd/lucem.nimble#L6
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ cswimr ];
mainProgram = "lucem";
};
}