Compare commits

..

4 commits

5 changed files with 52 additions and 39 deletions

37
flake.lock generated
View file

@ -592,22 +592,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": {
"locked": {
"lastModified": 1733759999,
"narHash": "sha256-463SNPWmz46iLzJKRzO3Q2b0Aurff3U1n0nYItxq7jU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a73246e2eef4c6ed172979932bc80e1404ba2d56",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": { "nixvim": {
"inputs": { "inputs": {
"devshell": "devshell", "devshell": "devshell",
@ -766,8 +750,7 @@
"nixvim": "nixvim", "nixvim": "nixvim",
"nur": "nur", "nur": "nur",
"plasma-manager": "plasma-manager", "plasma-manager": "plasma-manager",
"sops-nix": "sops-nix", "sops-nix": "sops-nix"
"zen-browser": "zen-browser"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -901,24 +884,6 @@
"repo": "treefmt-nix", "repo": "treefmt-nix",
"type": "github" "type": "github"
} }
},
"zen-browser": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1733840403,
"narHash": "sha256-j5hmZ/Oudzr4/HB383uUvY86PxB4c94+7QRV109kOpE=",
"owner": "0xc000022070",
"repo": "zen-browser-flake",
"rev": "ddbfcd69583724e6d142af98010411ac26c2029d",
"type": "github"
},
"original": {
"owner": "0xc000022070",
"repo": "zen-browser-flake",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -28,6 +28,11 @@ rec {
''; '';
}; };
home.packages = with pkgs; [
ruff
ruff-lsp
];
programs.vscode = { programs.vscode = {
enable = true; enable = true;
enableUpdateCheck = false; enableUpdateCheck = false;
@ -273,6 +278,7 @@ rec {
"source.organizeImports" = "explicit"; "source.organizeImports" = "explicit";
}; };
}; };
"ruff.path" = [ "${pkgs.ruff}/bin/ruff" ];
"python.terminal.activateEnvironment" = false; "python.terminal.activateEnvironment" = false;
"python.terminal.activateEnvInCurrentTerminal" = false; "python.terminal.activateEnvInCurrentTerminal" = false;
"[csharp]" = { "[csharp]" = {

View file

@ -71,6 +71,15 @@
variant = ""; variant = "";
}; };
# Add /etc/current-system-packages
environment.etc."current-system-packages".text =
let
packages = builtins.map (p: "${p.name}") config.environment.systemPackages;
sortedUnique = builtins.sort builtins.lessThan (pkgs.lib.lists.unique packages);
formatted = builtins.concatStringsSep "\n" sortedUnique;
in
formatted;
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;

View file

@ -47,7 +47,7 @@ def read_secret_file(secret: str, home: bool = False) -> str:
return secret return secret
def does_desktop_entry_exist(desktop_entry: str) -> bool: def does_desktop_entry_exist(desktop_entry: str, show_all_paths: bool = True) -> bool:
if not desktop_entry: if not desktop_entry:
raise ValueError("Please provide the full filename of the desktop entry.") raise ValueError("Please provide the full filename of the desktop entry.")
@ -71,11 +71,15 @@ def does_desktop_entry_exist(desktop_entry: str) -> bool:
entry_paths = [os.path.join(path, "applications") for path in xdg_data_dirs] entry_paths = [os.path.join(path, "applications") for path in xdg_data_dirs]
entry_paths.append(os.path.expanduser("~/.local/share/applications")) entry_paths.append(os.path.expanduser("~/.local/share/applications"))
print(f"Checking the following paths for {desktop_entry}:\n{entry_paths}\n{'-'*20}") if show_all_paths:
print(
f"Checking the following paths for {desktop_entry}:\n{entry_paths}\n{'-'*20}"
)
for entry_path in entry_paths: for entry_path in entry_paths:
entry_file = Path(entry_path) / f"{desktop_entry}" entry_file = Path(entry_path) / f"{desktop_entry}"
print(f"Checking for {entry_file}") if show_all_paths:
print(f"Checking for {entry_file}")
if entry_file.is_file(): if entry_file.is_file():
print(f"{desktop_entry} found in {entry_path}") print(f"{desktop_entry} found in {entry_path}")
return True return True

View file

@ -0,0 +1,29 @@
#! /usr/bin/env nix-shell
#! nix-shell /etc/nixos/scripts/nix/python.nix -i python
import argparse
from common.common import does_desktop_entry_exist # type: ignore
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog="does-desktop-entry-exist.py",
description="Check if a desktop entry exists.",
epilog="Example usage: does-desktop-entry-exist.py org.kde.konsole",
)
parser.add_argument(
"desktop_entry",
help="The desktop entry to check for.",
)
parser.add_argument(
"-v",
"--verbose",
help="Prints all of the paths that will be checked by the script. Exists so NixOS users don't get their terminals flooded when running the script.",
action="store_true",
)
args = parser.parse_args()
does_desktop_entry_exist(
desktop_entry=args.desktop_entry, show_all_paths=args.verbose
)