diff --git a/homes/x86_64-linux/admin@jallen-nas/default.nix b/homes/x86_64-linux/admin@jallen-nas/default.nix index 237554e..7bd92fa 100755 --- a/homes/x86_64-linux/admin@jallen-nas/default.nix +++ b/homes/x86_64-linux/admin@jallen-nas/default.nix @@ -20,38 +20,39 @@ }; sops = { - age.keyFile = "/home/admin/.config/sops/age/keys.txt"; - defaultSopsFile = "/etc/nixos/secrets/secrets.yaml"; - validateSopsFiles = false; - secrets = { - "ssh-keys-public/jallen-nas" = { - path = "/home/admin/.ssh/id_ed25519.pub"; - mode = "0644"; - }; - "ssh-keys-private/jallen-nas" = { - path = "/home/admin/.ssh/id_ed25519"; - mode = "0600"; - }; - "ssh-keys-public/desktop-nixos" = { - path = "/home/admin/.ssh/authorized_keys"; - mode = "0600"; - }; + # enable = true; + # age.keyFile = "/home/admin/.config/sops/age/keys.txt"; + # defaultSopsFile = "/etc/nixos/secrets/secrets.yaml"; + # validateSopsFiles = false; + # secrets = { + # "ssh-keys-public/jallen-nas" = { + # path = "/home/admin/.ssh/id_ed25519.pub"; + # mode = "0644"; + # }; + # "ssh-keys-private/jallen-nas" = { + # path = "/home/admin/.ssh/id_ed25519"; + # mode = "0600"; + # }; + # "ssh-keys-public/desktop-nixos" = { + # path = "/home/admin/.ssh/authorized_keys"; + # mode = "0600"; + # }; - "ssh-keys-public/desktop-nixos-root" = { - path = "/home/admin/.ssh/authorized_keys2"; - mode = "0600"; - }; + # "ssh-keys-public/desktop-nixos-root" = { + # path = "/home/admin/.ssh/authorized_keys2"; + # mode = "0600"; + # }; - "ssh-keys-public/desktop-windows" = { - path = "/home/admin/.ssh/authorized_keys3"; - mode = "0600"; - }; + # "ssh-keys-public/desktop-windows" = { + # path = "/home/admin/.ssh/authorized_keys3"; + # mode = "0600"; + # }; - "ssh-keys-public/macbook-macos" = { - path = "/home/admin/.ssh/authorized_keys4"; - mode = "0600"; - }; - }; + # "ssh-keys-public/macbook-macos" = { + # path = "/home/admin/.ssh/authorized_keys4"; + # mode = "0600"; + # }; + # }; }; programs = { diff --git a/modules/darwin/home/default.nix b/modules/darwin/home/default.nix index f49cf70..f0a0517 100644 --- a/modules/darwin/home/default.nix +++ b/modules/darwin/home/default.nix @@ -35,9 +35,9 @@ # Pass inputs so external modules can access them extraSpecialArgs = { inherit inputs namespace; - overlays = with inputs; [ - nix-vscode-extensions.overlays.default - ]; + # overlays = with inputs; [ + # nix-vscode-extensions.overlays.default + # ]; }; # Make ALL external HM modules available globally diff --git a/modules/home/programs/update-checker/default.nix b/modules/home/programs/update-checker/default.nix index 2776a36..fed4f6c 100644 --- a/modules/home/programs/update-checker/default.nix +++ b/modules/home/programs/update-checker/default.nix @@ -17,7 +17,10 @@ let import feedparser import requests - token = os.get_env("GITHUB_TOKEN") + token = None + + with open('${config.sops.secrets."github-token".path}', 'r') as token_file: + token = token_file.readline() auth = Auth.Token(token) @@ -27,9 +30,9 @@ let result = None prefetch = None ghub = Github(auth=auth) - print(" getting repo " + owner + "/" + repo) - repo = ghub.get_repo(owner + "/" + repo) - if "-b" in version: + print(' getting repo ' + owner + '/' + repo) + repo = ghub.get_repo(owner + '/' + repo) + if '-b' in version: release = repo.get_releases()[0] latest_version = release.name else: @@ -47,48 +50,48 @@ let if latest_version is not None: - if latest_version.replace("v","") != version.replace("v",""): - print(" update found") - print(" Current version: " + version) - print(" Latest version: " + latest_version) - result = subprocess.check_output(["nix-prefetch-git", "--quiet", repo.clone_url, "--rev", latest_version]) + if latest_version.replace('v',''\'') != version.replace('v',''\''): + print(' update found') + print(' Current version: ' + version) + print(' Latest version: ' + latest_version) + result = subprocess.check_output(['nix-prefetch-git', '--quiet', repo.clone_url, '--rev', latest_version]) prefetch = json.loads(result) - print(" New hash: " + prefetch.get("hash")) + print(' New hash: ' + prefetch.get('hash')) else: - print(" no update") + print(' no update') ghub.close() except Exception as e: print(e) def check_codeberg(owner, repo, version): - feed = feedparser.parse("https://codeberg.org/{0}/{1}/releases.rss".format(owner, repo)) + feed = feedparser.parse('https://codeberg.org/{0}/{1}/releases.rss'.format(owner, repo)) if feed.status == 200: entry = feed.entries[0] - if entry.title.replace("v","") != version.replace("v",""): - print(" update found") - print(" Current version: " + version) - print(" Latest version: " + entry.title) - sha256 = subprocess.check_output(["nix-prefetch-url", url.replace("''\${version}", entry.title.replace("v", ""))]) - prefetch = subprocess.check_output(["nix", "hash", "convert", "--hash-algo", "sha256", str(sha256.decode("utf-8").strip())]) - print(" New hash: " + prefetch.decode("utf-8").strip()) + if entry.title.replace('v',''\'') != version.replace('v',''\''): + print(' update found') + print(' Current version: ' + version) + print(' Latest version: ' + entry.title) + sha256 = subprocess.check_output(['nix-prefetch-url', url.replace(''\'''\${version}', entry.title.replace('v', ''\''))]) + prefetch = subprocess.check_output(['nix', 'hash', 'convert', '--hash-algo', 'sha256', str(sha256.decode('utf-8').strip())]) + print(' New hash: ' + prefetch.decode('utf-8').strip()) else: - print(" no update") + print(' no update') def check_open_vsx(publisher, name, version): - open_vsx = requests.get("https://open-vsx.org/api/" + publisher + "/" + name) + open_vsx = requests.get('https://open-vsx.org/api/' + publisher + '/' + name) if open_vsx.status_code == 200: extension = open_vsx.json() - latest_version = extension.get("version") - url = extension.get("files").get("download") - if latest_version.replace("v","") != version.replace("v",""): - print(" update found") - print(" Current version: " + version) - print(" Latest version: " + latest_version) - sha256 = subprocess.check_output(["nix-prefetch-url", url]) - prefetch = subprocess.check_output(["nix", "hash", "convert", "--hash-algo", "sha256", str(sha256.decode("utf-8").strip())]) - print(" New hash: " + prefetch.decode("utf-8").strip()) + latest_version = extension.get('version') + url = extension.get('files').get('download') + if latest_version.replace('v',''\'') != version.replace('v',''\''): + print(' update found') + print(' Current version: ' + version) + print(' Latest version: ' + latest_version) + sha256 = subprocess.check_output(['nix-prefetch-url', url]) + prefetch = subprocess.check_output(['nix', 'hash', 'convert', '--hash-algo', 'sha256', str(sha256.decode('utf-8').strip())]) + print(' New hash: ' + prefetch.decode('utf-8').strip()) else: - print(" no update") + print(' no update') def parse_nix(package_spec): version = None @@ -100,168 +103,167 @@ let name = None publisher = None for line in package_spec.readlines(): - if "owner = "" in line and owner is None: - owner = line.split(" = ")[-1].replace(""", "").replace(";\n", "") - if "repo = "" in line and repo is None: - repo = line.split(" = ")[-1].replace(""", "").replace(";\n", "") - if "version = "" in line and version is None: - version = line.split(" = ")[-1].replace(""", "").replace(";\n", "") - if "rev = "" in line and "''\${version}" not in line: - version = line.split(" = ")[-1].replace(""", "").replace(";\n", "") - if "url = "" in line and url is None: - url = line.split(" = ")[-1].replace(""", "").replace(";\n", "") - if "sha256 = "" in line or " hash = "" in line and current_hash is None: - current_hash = line.split(" = ")[-1].replace(""", "").replace(";\n", "") - if "pname = "" in line and pname is None: - pname = line.split(" = ")[-1].replace(""", "").replace(";\n", "") - if " name = "" in line and name is None: - name = line.split(" = ")[-1].replace(""", "").replace(";\n", "") - if "publisher = "" in line and publisher is None: - publisher = line.split(" = ")[-1].replace(""", "").replace(";\n", "") + if 'owner = "' in line and owner is None: + owner = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') + if 'repo = "' in line and repo is None: + repo = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') + if 'version = "' in line and version is None: + version = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') + if 'rev = "' in line and ''\'''\${version}' not in line: + version = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') + if 'url = "' in line and url is None: + url = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') + if 'sha256 = "' in line or ' hash = "' in line and current_hash is None: + current_hash = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') + if 'pname = "' in line and pname is None: + pname = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') + if ' name = "' in line and name is None: + name = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') + if 'publisher = "' in line and publisher is None: + publisher = line.split(' = ')[-1].replace('"', ''\'').replace(';\n', ''\'') if url is None and repo is not None: - if "pname" in repo: - repo = repo.replace("''\${pname}", pname) - url = "https://github.com/{0}/{1}/releases/tag/{2}".format(owner, repo, version) + if 'pname' in repo: + repo = repo.replace(''\'''\${pname}', pname) + url = 'https://github.com/{0}/{1}/releases/tag/{2}'.format(owner, repo, version) - if url is not None and repo is None and "github" in url: - owner = url.split("github.com/")[-1].split("/")[0] - repo = url.split("github.com/")[-1].split("/")[1] + if url is not None and repo is None and 'github' in url: + owner = url.split('github.com/')[-1].split('/')[0] + repo = url.split('github.com/')[-1].split('/')[1] - if url is not None and repo is None and "codeberg" in url: - owner = url.split("codeberg.org/")[-1].split("/")[0] - repo = url.split("codeberg.org/")[-1].split("/")[1] + if url is not None and repo is None and 'codeberg' in url: + owner = url.split('codeberg.org/')[-1].split('/')[0] + repo = url.split('codeberg.org/')[-1].split('/')[1] if url is not None and version is None: - version = url.split("/")[-1].replace(".tar.gz", "") + version = url.split('/')[-1].replace('.tar.gz', ''\'') if url is not None and publisher is not None: - url = url.replace("''\${publisher}", publisher).replace("''\${name}", name) + url = url.replace(''\'''\${publisher}', publisher).replace(''\'''\${name}', name) return url, current_hash, owner, repo, pname, name, publisher, version - def parse_json(json_versions, flavor=""): + def parse_json(json_versions, flavor=''\''): versions = json.load(json_versions) - linux_versions = versions.get("linux") - config_versions = versions.get("config") - patch_versions = versions.get("patches") - zfs_versions = versions.get("zfs") + linux_versions = versions.get('linux') + config_versions = versions.get('config') + patch_versions = versions.get('patches') + zfs_versions = versions.get('zfs') check_kernel(linux_versions, flavor) check_cachy_config(config_versions, flavor) check_patch_versions(patch_versions, flavor) check_zfs_versions(zfs_versions, flavor) - def check_kernel(linux_versions, flavor=""): - srcinfo = requests.get("https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos" + flavor + "/.SRCINFO") - for line in srcinfo.text.split("\n"): - if "pkgver = " in line: - kernel_version = line.split("=")[-1].strip() - if kernel_version[-2:] == ".0": + def check_kernel(linux_versions, flavor=''\''): + srcinfo = requests.get('https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos' + flavor + '/.SRCINFO') + for line in srcinfo.text.split('\n'): + if 'pkgver = ' in line: + kernel_version = line.split('=')[-1].strip() + if kernel_version[-2:] == '.0': kernel_version = kernel_version[:-2] - if flavor in ["", "-lts", "-server", "-gcc", "-hardened"]: - release_src = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-" + kernel_version + ".tar.xz" - if flavor == "-rc": - release_src = "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-" + kernel_version.replace(".rc", "-rc") + ".tar.gz" - sha256 = subprocess.check_output(["nix-prefetch-url", release_src]) - prefetch = subprocess.check_output(["nix", "hash", "convert", "--hash-algo", "sha256", str(sha256.decode("utf-8").strip())]) - current_version = linux_versions.get("version") - current_hash = linux_versions.get("hash") - latest_hash = prefetch.decode("utf-8").strip() - print(" Checking linux versions...") + if flavor in [''\'', '-lts', '-server', '-gcc', '-hardened']: + release_src = 'https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-' + kernel_version + '.tar.xz' + if flavor == '-rc': + release_src = 'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-' + kernel_version.replace('.rc', '-rc') + '.tar.gz' + sha256 = subprocess.check_output(['nix-prefetch-url', release_src]) + prefetch = subprocess.check_output(['nix', 'hash', 'convert', '--hash-algo', 'sha256', str(sha256.decode('utf-8').strip())]) + current_version = linux_versions.get('version') + current_hash = linux_versions.get('hash') + latest_hash = prefetch.decode('utf-8').strip() + print(' Checking linux versions...') if current_hash != latest_hash: - print(" Current rev: " + current_version) - print(" Current hash: " + current_hash) - print(" New rev: " + kernel_version) - print(" New hash: " + latest_hash) + print(' Current rev: ' + current_version) + print(' Current hash: ' + current_hash) + print(' New rev: ' + kernel_version) + print(' New hash: ' + latest_hash) else: - print(" no update") + print(' no update') - def check_cachy_config(config_versions, flavor=""): - result = subprocess.check_output(["nix-prefetch-git", "--quiet", "https://github.com/CachyOS/linux-cachyos.git"]) + def check_cachy_config(config_versions, flavor=''\''): + result = subprocess.check_output(['nix-prefetch-git', '--quiet', 'https://github.com/CachyOS/linux-cachyos.git']) prefetch = json.loads(result) - current_version = config_versions.get("rev") - latest_version = prefetch.get("rev") - print(" Checking config versions...") + current_version = config_versions.get('rev') + latest_version = prefetch.get('rev') + print(' Checking config versions...') if current_version != latest_version: - print(" Current rev: " + current_version) - print(" New rev: " + latest_version) - print(" New hash: " + prefetch.get("hash")) + print(' Current rev: ' + current_version) + print(' New rev: ' + latest_version) + print(' New hash: ' + prefetch.get('hash')) else: - print(" no update") + print(' no update') - def check_patch_versions(patch_versions, flavor=""): - result = subprocess.check_output(["nix-prefetch-git", "--quiet", "https://github.com/CachyOS/kernel-patches.git"]) + def check_patch_versions(patch_versions, flavor=''\''): + result = subprocess.check_output(['nix-prefetch-git', '--quiet', 'https://github.com/CachyOS/kernel-patches.git']) prefetch = json.loads(result) - current_version = patch_versions.get("rev") - latest_version = prefetch.get("rev") - print(" Checking patch versions...") + current_version = patch_versions.get('rev') + latest_version = prefetch.get('rev') + print(' Checking patch versions...') if current_version != latest_version: - print(" Current rev: " + current_version) - print(" New rev: " + latest_version) - print(" New hash: " + prefetch.get("hash")) + print(' Current rev: ' + current_version) + print(' New rev: ' + latest_version) + print(' New hash: ' + prefetch.get('hash')) else: - print(" no update") + print(' no update') - def kconfig_to_nix(flavor=""): - kconfig_result = subprocess.check_output(["nix", "build", ".#nixosConfigurations.jallen-nas.pkgs.linuxPackages_cachyos" + flavor + ".kernel.kconfigToNix", "--no-link", "--print-out-paths"]) - config_file = kconfig_result.decode("utf-8").strip() - if flavor == "": - cachy_flavor = "-gcc" - result = subprocess.check_output(["cat", config_file]) - with open("/etc/nixos/packages/linux-cachyos/config-nix/cachyos" + cachy_flavor + ".x86_64-linux.nix", "w") as config: - config.write(result.decode("utf-8").strip()) + def kconfig_to_nix(flavor=''\''): + kconfig_result = subprocess.check_output(['nix', 'build', '.#nixosConfigurations.jallen-nas.pkgs.linuxPackages_cachyos' + flavor + '.kernel.kconfigToNix', '--no-link', '--print-out-paths']) + config_file = kconfig_result.decode('utf-8').strip() + if flavor == ''\'': + cachy_flavor = '-gcc' + result = subprocess.check_output(['cat', config_file]) + with open('/etc/nixos/packages/linux-cachyos/config-nix/cachyos' + cachy_flavor + '.x86_64-linux.nix', 'w') as config: + config.write(result.decode('utf-8').strip()) - def check_zfs_versions(zfs_versions, flavor=""): - result = requests.get("https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos" + flavor + "/PKGBUILD") - for line in result.text.split("\n"): - if "git+https://github.com/cachyos/zfs.git#commit=" in line: - zfs_rev = line.split("zfs.git#commit=")[-1].replace("")", "") - result = subprocess.check_output(["nix-prefetch-git", "--quiet", "https://github.com/CachyOS/zfs.git", "--rev", zfs_rev]) + def check_zfs_versions(zfs_versions, flavor=''\''): + result = requests.get('https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos' + flavor + '/PKGBUILD') + for line in result.text.split('\n'): + if 'git+https://github.com/cachyos/zfs.git#commit=' in line: + zfs_rev = line.split('zfs.git#commit=')[-1].replace('")', ''\'') + result = subprocess.check_output(['nix-prefetch-git', '--quiet', 'https://github.com/CachyOS/zfs.git', '--rev', zfs_rev]) prefetch = json.loads(result) - current_version = zfs_versions.get("rev") - latest_version = prefetch.get("rev") - print(" Checking zfs versions...") + current_version = zfs_versions.get('rev') + latest_version = prefetch.get('rev') + print(' Checking zfs versions...') if current_version != latest_version: - print(" Current rev: " + current_version) - print(" New rev: " + latest_version) - print(" New hash: " + prefetch.get("hash")) + print(' Current rev: ' + current_version) + print(' New rev: ' + latest_version) + print(' New hash: ' + prefetch.get('hash')) else: - print(" no update") + print(' no update') - for (root,dirs,files) in os.walk("/etc/nixos/packages",topdown=True): - if "default.nix" in files and "versions.json" not in files: - continue - print(root.split("/")[-1]) - with open(root + "/default.nix", "r") as package_spec: + for (root,dirs,files) in os.walk('/etc/nixos/packages',topdown=True): + if 'default.nix' in files and 'versions.json' not in files: + print(root.split('/')[-1]) + with open(root + '/default.nix', 'r') as package_spec: url, current_hash, owner, repo, pname, name, publisher, version = parse_nix(package_spec) - if owner is not None and repo is not None and "codeberg" in url: + if owner is not None and repo is not None and 'codeberg' in url: check_codeberg(owner, repo, version) - elif owner is not None and repo is not None and "github" in url: + elif owner is not None and repo is not None and 'github' in url: check_github(owner, repo, version) - elif publisher is not None and "open-vsx" in url: + elif publisher is not None and 'open-vsx' in url: check_open_vsx(publisher, name, version) else: if url is not None: print(url) - if "default.nix" in files and "versions.json" in files: - with open(root + "/versions.json", "r") as json_versions: - print("Checking Linux CachyOS") + if 'default.nix' in files and 'versions.json' in files: + with open(root + '/versions.json', 'r') as json_versions: + print('Checking Linux CachyOS') parse_json(json_versions) - with open(root + "/versions-rc.json", "r") as json_versions: - print("Checking Linux CachyOS RC") - parse_json(json_versions, "-rc") - with open(root + "/versions-lts.json", "r") as json_versions: - print("Checking Linux CachyOS LTS") - parse_json(json_versions, "-lts") - with open(root + "/versions-hardened.json", "r") as json_versions: - print("Checking Linux CachyOS Hardened") - parse_json(json_versions, "-hardened") + with open(root + '/versions-rc.json', 'r') as json_versions: + print('Checking Linux CachyOS RC') + parse_json(json_versions, '-rc') + with open(root + '/versions-lts.json', 'r') as json_versions: + print('Checking Linux CachyOS LTS') + parse_json(json_versions, '-lts') + with open(root + '/versions-hardened.json', 'r') as json_versions: + print('Checking Linux CachyOS Hardened') + parse_json(json_versions, '-hardened') ''; in { diff --git a/modules/home/sops/default.nix b/modules/home/sops/default.nix index 06cc3ec..df5c0dc 100644 --- a/modules/home/sops/default.nix +++ b/modules/home/sops/default.nix @@ -10,7 +10,7 @@ in { imports = [ ./options.nix ]; - config = lib.mkIf cfg.enable { + config = { sops = { age.keyFile = "/home/${config.${namespace}.user.name}/.config/sops/age/keys.txt"; defaultSopsFile = "/etc/nixos/secrets/secrets.yaml"; @@ -25,7 +25,7 @@ in }; }; - programs.zsh.initExtra = '' + programs.zsh.initContent = '' if [ -f ${config.sops.templates.".env".path} ]; then export $(grep -v '^#' ${config.sops.templates.".env".path} | xargs) fi diff --git a/modules/nixos/home/default.nix b/modules/nixos/home/default.nix index d78d83d..8502e8f 100644 --- a/modules/nixos/home/default.nix +++ b/modules/nixos/home/default.nix @@ -53,9 +53,9 @@ in # Pass inputs so external modules can access them extraSpecialArgs = { inherit inputs namespace hasDestopEnvironment; - overlays = with inputs; [ - nix-vscode-extensions.overlays.default - ]; + # overlays = with inputs; [ + # nix-vscode-extensions.overlays.default + # ]; }; # Make ALL external HM modules available globally diff --git a/modules/nixos/nix/default.nix b/modules/nixos/nix/default.nix index 2816323..d8760cd 100644 --- a/modules/nixos/nix/default.nix +++ b/modules/nixos/nix/default.nix @@ -8,28 +8,34 @@ programs.ccache = { enable = true; packageNames = [ - # "ffmpeg" - # "ffmpeg-full" - # "ffmpeg-headless-rpi" - # "gjs" - # "gst-plugins-bad" - # "gtk4" - # "jemalloc" - # "libcamera-rpi" - # "libraspberrypi" - # "libsecret" - # "linux" - # "opencv" - # "pipewire" - # "qemu" - # # qemu.pname - # "raspberrypi-utils" - # "sdl" - # "sdl2" - # "torch" - # "uv" - # "webkitgtk" - # # "yubioath-flutter" + "cachyos-lto" + "cachyos-lto-x86_64-unknown-linux-gnu-6.18.0" + "cachyos-lto-x86_64-unknown-linux-gnu" + "cachyos-lto-znver4" + "cachyos-server-lto" + "cachyos-server-lto-znver4" + "ffmpeg" + "ffmpeg-full" + "ffmpeg-headless-rpi" + "gjs" + "gst-plugins-bad" + "gtk4" + "jemalloc" + "libcamera-rpi" + "libraspberrypi" + "libsecret" + "linux" + "opencv" + "pipewire" + "qemu" + # qemu.pname + "raspberrypi-utils" + "sdl" + "sdl2" + "torch" + "uv" + "webkitgtk" + # "yubioath-flutter" ]; cacheDir = "/var/cache/ccache"; # default location }; diff --git a/packages/linux-cachyos/default.nix b/packages/linux-cachyos/default.nix index 40f9a1d..75c5dd0 100644 --- a/packages/linux-cachyos/default.nix +++ b/packages/linux-cachyos/default.nix @@ -23,6 +23,7 @@ let ltoKernelAttrs = { taste = "linux-cachyos"; + pname = "cachyos-lto"; configPath = ./config-nix/cachyos-lto.x86_64-linux.nix; # Pass the unified arguments (including the resolved 'self') to llvm-pkgs @@ -63,6 +64,7 @@ let serverLtoKernelAttrs = { taste = "linux-cachyos-server"; + pname = "cachyos-server-lto"; configPath = ./config-nix/cachyos-server-lto.x86_64-linux.nix; basicCachy = false; cpuSched = "eevdf"; @@ -143,6 +145,7 @@ let gccKernel = mkCachyKernel { taste = "linux-cachyos"; + pname = "cachyos-gcc"; configPath = ./config-nix/cachyos-gcc.x86_64-linux.nix; # since all flavors use the same versions.json, we just need the updateScript in one of them withUpdateScript = "stable"; @@ -160,6 +163,7 @@ in cachyos-lts = mkCachyKernel { taste = "linux-cachyos-lts"; + pname = "cachyos-lts"; configPath = ./config-nix/cachyos-lts.x86_64-linux.nix; versions = ltsVersions; @@ -173,6 +177,7 @@ in cachyos-rc = mkCachyKernel { taste = "linux-cachyos-rc"; + pname = "cachyos-rc"; configPath = ./config-nix/cachyos-rc.x86_64-linux.nix; versions = rcVersions; @@ -188,6 +193,7 @@ in cachyos-lto-znver4 = mkCachyKernel ( ltoKernelAttrs // { + pname = "cachyos-lto-znver4"; configPath = ./config-nix/cachyos-znver4.x86_64-linux.nix; } ); @@ -196,6 +202,7 @@ in cachyos-server = mkCachyKernel { taste = "linux-cachyos-server"; + pname = "cachyos-server"; configPath = ./config-nix/cachyos-server.x86_64-linux.nix; basicCachy = false; cpuSched = "eevdf"; @@ -215,11 +222,13 @@ in serverLtoKernelAttrs // { configPath = ./config-nix/cachyos-znver4.x86_64-linux.nix; + pname = "cachyos-server-lto-znver4"; } ); cachyos-hardened = mkCachyKernel { taste = "linux-cachyos-hardened"; + pname = "cachyos-hardened"; configPath = ./config-nix/cachyos-hardened.x86_64-linux.nix; cpuSched = "hardened"; diff --git a/packages/linux-cachyos/kernel.nix b/packages/linux-cachyos/kernel.nix index a874fa4..0981b64 100644 --- a/packages/linux-cachyos/kernel.nix +++ b/packages/linux-cachyos/kernel.nix @@ -11,6 +11,7 @@ kernelPatches ? [ ], features ? null, randstructSeed ? "", + pname ? "unknown", # For tests kernelPackages, flakes, @@ -25,6 +26,7 @@ let in (linuxManualConfig { inherit + pname stdenv version features diff --git a/packages/linux-cachyos/packages-for.nix b/packages/linux-cachyos/packages-for.nix index 23b2aa4..74d2d8d 100644 --- a/packages/linux-cachyos/packages-for.nix +++ b/packages/linux-cachyos/packages-for.nix @@ -32,6 +32,7 @@ description ? "Linux EEVDF-BORE scheduler Kernel by CachyOS with other patches and improvements", # For flakes inputs ? { }, + pname ? "unknown", # Explicitly accept nixpkgs, falling back to inputs or the system path nixpkgs ? inputs.nixpkgs or pkgs.path, }: @@ -104,8 +105,32 @@ let }; linuxConfigTransfomed = import configPath; + # normalizeKernelName = pname: drv: + # drv.overrideAttrs (old: let + # ver = old.version or (lib.getVersion old.name or "unknown"); + # in { + # __intentionallyOverridingVersion = true; + # pname = (if useLTO != "none" then "${pname}-lto" else pname); + # version = ver; + # name = "${pname}-${ver}"; + # }); + + # versionSuffix = "+C${shorter versions.config.rev}+P${shorter versions.patches.rev}"; + + # kernel = + # normalizeKernelName (cachyConfig.taste or "linux") + # (callPackage ./kernel.nix { + # inherit cachyConfig stdenv kconfigToNix; + # kernelPatches = [ ]; + # configfile = preparedConfigfile; + # config = linuxConfigTransfomed; + # flakes = inputs.flakes or null; + # final = inputs.final or null; + # kernelPackages = packagesWithRightPlatforms; + # }); + kernel = callPackage ./kernel.nix { - inherit cachyConfig stdenv kconfigToNix; + inherit cachyConfig pname stdenv kconfigToNix; kernelPatches = [ ]; configfile = preparedConfigfile; config = linuxConfigTransfomed;