{"id":14968054,"url":"https://github.com/divnix/nosys","last_synced_at":"2025-06-12T19:07:51.925Z","repository":{"id":103392956,"uuid":"562309991","full_name":"divnix/nosys","owner":"divnix","description":"No system, no hassle","archived":false,"fork":false,"pushed_at":"2024-02-26T18:16:21.000Z","size":29,"stargazers_count":35,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-07T13:04:02.304Z","etag":null,"topics":["flakes","nix","nixos","nixos-flake","nixpkgs"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/divnix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-05T23:44:10.000Z","updated_at":"2025-04-04T10:28:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"560f2d76-5d63-48a3-b638-3f01e23a04e9","html_url":"https://github.com/divnix/nosys","commit_stats":{"total_commits":23,"total_committers":2,"mean_commits":11.5,"dds":0.3913043478260869,"last_synced_commit":"798ee92962613f296c0ed89a098a7fba9978ffc0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/divnix/nosys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divnix%2Fnosys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divnix%2Fnosys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divnix%2Fnosys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divnix%2Fnosys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/divnix","download_url":"https://codeload.github.com/divnix/nosys/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divnix%2Fnosys/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259519862,"owners_count":22870371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flakes","nix","nixos","nixos-flake","nixpkgs"],"created_at":"2024-09-24T13:39:10.370Z","updated_at":"2025-06-12T19:07:51.900Z","avatar_url":"https://github.com/divnix.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: 2022 The Standard Authors\n\nSPDX-License-Identifier: Unlicense\n--\u003e\n# Why?\n\nThere is a long-standing conversation about Nix flakes concerning the handling of\ndifferent system architectures. There has been a lot of back and forth and a lot of\nbrainstorming, but for the time being, things have mostly stagnated.\n\nFor now, this flake is a straightforward demonstration of the \"system as an input\"\nconcept that has been thrown around for a while now. It is not perfect, and might be\nmore appropriate to be handled by Nix upstream eventually, but does offer some genuine\nconvenience.\n\nIn practice, it makes handling the flake output schema easier when you just don't\ncare too much about specially handling the system architecture.\n\nIt is deliberately simple, and otherwise keeps the output schema of flakes unmodified\nwhich should hopefully allow it to work seamlessly with more elaborate tools or flake\nlibraries if desired. In fact, it is already an upstream of\n[paisano](https://github.com/paisano-nix/core) to provide this same convenience in that\nproject.\n\nIn addition, there are also a few optional niceties such as special\n[nixpkgs handling](#nixpkgs-convenience), and an escape hatch for outputs that don't\nneed to be system specced.\n\n# Init\n\n`nix flake new project -t github:divnix/nosys`\n\n# Usage\n\n```nix\n# flake.nix\n{\n  inputs.nosys.url = \"github:divnix/nosys\";\n  # file with list of systems: [\"x86_64-linux\" /* ... */ ]\n  inputs.systems.url = \"path:./flake/systems.nix\";\n  inputs.systems.flake = false;\n\n  outputs = inputs @ {\n    nosys,\n    nixpkgs, # \u003c---- This `nixpkgs` still has the `system` e.g. legacyPackages.${system}.zlib\n    ...\n  }: let outputs = import ./flake/outputs.nix;\n     in nosys inputs outputs;\n}\n```\n\nJust like a regular `outputs` functor:\n```nix\n# ./flake/outputs.nix\n{\n  self,\n  nixpkgs, # \u003c---- This `nixpkgs` has systems removed e.g. legacyPackages.zlib\n  ...,\n}: let\n  inherit (nixpkgs.legacyPackages) pkgs;\nin {\n  # system dependant outputs\n  devShells.default = self.devShells.dev;\n  devShells.dev = pkgs.mkShell {\n    buildInputs = with pkgs; [/* ... */];\n  };\n\n  # attributes prefixed with a single underscore (`_`) are kept system independant\n  _lib.f = x: x; # becomes `outputs.lib.f` in the final flake\n  # attributes with two underscores (`__`) underscores are passed through unmodified\n  __functor = self: self.lib.f;\n\n}\n```\n\n\n# Systems\n\nThe systems can be a Nix list of systems or a path to a nix file with one. This means if you wish,\nyou can even point to the file as a flake input, so that downstream can modify the systems with\n`follows`.\n\n`nosys` will use its own defaults if no flake input named `systems` exist. You can also\nsimply override systems as a list:\n```nix\nnosys (inputs' // {systems = [\"x86_64-darwin\"];}) # ({self, ...}:\n```\n\n# Nixpkgs Convenience\n\nDefining a flake input called `pkgs` that points to a checkout of nixos/nixpkgs will be handled\nspecially, for convenience purposes. Instead of simply desystemizing the input, the package set\nwill also be brought to the top-level of the flake's output schema for convenience. Additionally,\nnixpkgs `lib` output will be brought into scope for quick reference of library functions. e.g:\n\n```nix\n{\n  inputs.pkgs.url = \"github:nixos/nixpkgs/nixpkgs-unstable\";\n  outputs = inputs:\n    nosys inputs ({\n      lib, # can reference nixpkgs `lib` directly from output functor\n      pkgs,\n      ...\n    }: {\n      packages.default = pkgs.foo; # instead of pkgs.legacyPackages.foo\n    });\n}\n```\n\nIf you need to configure the nixpkgs collection, you can do so by adding the expected `config`\nattribute to the inputs passed to `nosys`:\n```nix\nnosys (inputs // {config.allowUnfree = true;}) ({pkgs, ...}: {\n  # unfree packages are now usable from `pkgs` here\n})\n```\n\n\n## Cross Compilation, et al.\n\nFor advanced cases like cross-compilation the systems are still available in the usual place when\nneeding to reference a different system than the one currently being defined. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivnix%2Fnosys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivnix%2Fnosys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivnix%2Fnosys/lists"}