From 74b4cf63fea27ffad41a5158e2a4cc3d51bd1ec6 Mon Sep 17 00:00:00 2001 From: flyinggecko Date: Tue, 9 Jul 2024 10:12:53 +0200 Subject: [PATCH 01/30] Initial commit --- .gitignore | 5 +++ LICENSE | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 + 3 files changed, 124 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a806510 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# ---> Nix +# Ignore build outputs from performing a nix-build or `nix build` command +result +result-* + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..17cb286 --- /dev/null +++ b/LICENSE @@ -0,0 +1,117 @@ +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + +signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice diff --git a/README.md b/README.md new file mode 100644 index 0000000..43ee3ab --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# nixos-runner + -- 2.47.2 From 50181d9e57871082fd4f3ef249fd3e5adaf8c22e Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 14:49:20 +0100 Subject: [PATCH 02/30] Flake: build nix containers * Add flake for building nixos containers for forgejo actions --- fake_nixpkgs/default.nix | 10 +++ flake.lock | 78 ++++++++++++++++ flake.nix | 187 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 275 insertions(+) create mode 100644 fake_nixpkgs/default.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/fake_nixpkgs/default.nix b/fake_nixpkgs/default.nix new file mode 100644 index 0000000..3001f60 --- /dev/null +++ b/fake_nixpkgs/default.nix @@ -0,0 +1,10 @@ +_: +throw '' + This container doesn't include nixpkgs. + + The best way to work around that is to pin your dependencies. See + https://nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs.html + + Or if you must, override the NIX_PATH environment variable with eg: + "NIX_PATH=nixpkgs=channel:nixos-unstable" +'' diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3c5952f --- /dev/null +++ b/flake.lock @@ -0,0 +1,78 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1738702386, + "narHash": "sha256-nJj8f78AYAxl/zqLiFGXn5Im1qjFKU8yBPKoWEeZN5M=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "030ba1976b7c0e1a67d9716b17308ccdab5b381e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1738680400, + "narHash": "sha256-ooLh+XW8jfa+91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "799ba5bffed04ced7067a91798353d360788b30d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b24d933 --- /dev/null +++ b/flake.nix @@ -0,0 +1,187 @@ +{ + description = "Nix-based oci images for actions"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + nixpkgs-unstable, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + inherit (nixpkgs) lib; + imagePackages = + pkgs: with pkgs; [ + bashInteractive + cacert + coreutils + curl + docker + findutils + gawk + gitFull + gnugrep + gnutar + gzip + jq + nodejs + openssl + openssh + rsync + sudo + wget + xz + makeWrapper + bats + shellcheck + reuse + lix + sops + nvd + ]; + containerLambda = + name: tag: pkgs': + let + pkgs = import pkgs' { inherit system; }; + in + pkgs.dockerTools.buildImageWithNixDb { + name = "git.flyinggecko.org/oci-images/nixos-runner/${name}"; + tag = tag; + copyToRoot = + with pkgs; + (imagePackages pkgs) + ++ [ + (pkgs.writeTextFile { + name = "passwd"; + destination = "/etc/passwd"; + text = builtins.concatStringsSep "\n" [ + "root:x:0:0:System administrator:/root:/bin/bash" + "nixbld1:x:30001:30000:Nix build user 1:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld2:x:30002:30000:Nix build user 2:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld3:x:30003:30000:Nix build user 3:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld4:x:30004:30000:Nix build user 4:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld5:x:30005:30000:Nix build user 5:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld6:x:30006:30000:Nix build user 6:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld7:x:30007:30000:Nix build user 7:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld8:x:30008:30000:Nix build user 8:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld9:x:30009:30000:Nix build user 9:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld10:x:30010:30000:Nix build user 10:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld11:x:30011:30000:Nix build user 11:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld12:x:30012:30000:Nix build user 12:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld13:x:30013:30000:Nix build user 13:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld14:x:30014:30000:Nix build user 14:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld15:x:30015:30000:Nix build user 15:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld16:x:30016:30000:Nix build user 16:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld17:x:30017:30000:Nix build user 17:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld18:x:30018:30000:Nix build user 18:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld19:x:30019:30000:Nix build user 19:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld20:x:30020:30000:Nix build user 20:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld21:x:30021:30000:Nix build user 21:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld22:x:30022:30000:Nix build user 22:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld23:x:30023:30000:Nix build user 23:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld24:x:30024:30000:Nix build user 24:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld25:x:30025:30000:Nix build user 25:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld26:x:30026:30000:Nix build user 26:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld27:x:30027:30000:Nix build user 27:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld28:x:30028:30000:Nix build user 28:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld29:x:30029:30000:Nix build user 29:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld30:x:30030:30000:Nix build user 30:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld31:x:30031:30000:Nix build user 31:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld32:x:30032:30000:Nix build user 32:/var/empty:/run/current-system/sw/bin/nologin" + "nobody:x:65534:65534:Unprivileged account (don't use!):/var/empty:/run/current-system/sw/bin/nologin" + ]; + }) + (pkgs.writeTextFile { + name = "group"; + destination = "/etc/group"; + text = builtins.concatStringsSep "\n" [ + "root:x:0:" + "wheel:x:1:" + "kmem:x:2:" + "tty:x:3:" + "messagebus:x:4:" + "disk:x:6:" + "audio:x:17:" + "floppy:x:18:" + "uucp:x:19:" + "lp:x:20:" + "cdrom:x:24:" + "tape:x:25:" + "video:x:26:" + "dialout:x:27:" + "utmp:x:29:" + "adm:x:55:" + "keys:x:96:" + "users:x:100:" + "input:x:174:" + "nixbld:x:30000:nixbld1,nixbld10,nixbld11,nixbld12,nixbld13,nixbld14,nixbld15,nixbld16,nixbld17,nixbld18,nixbld19,nixbld2,nixbld20,nixbld21,nixbld22,nixbld23,nixbld24,nixbld25,nixbld26,nixbld27,nixbld28,nixbld29,nixbld3,nixbld30,nixbld31,nixbld32,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9" + "nogroup:x:65534:" + ]; + }) + (pkgs.writeTextFile { + name = "nsswitch.conf"; + destination = "/etc/nsswitch.conf"; + text = builtins.concatStringsSep "\n" [ + "passwd: files mymachines systemd" + "group: files mymachines systemd" + "shadow: files" + "hosts: files mymachines dns myhostname" + "networks: files" + "ethers: files" + "services: files" + "protocols: files" + "rpc: files" + ]; + }) + (pkgs.writeTextFile { + name = "nix.conf"; + destination = "/etc/nix/nix.conf"; + text = builtins.concatStringsSep "\n" [ + "accept-flake-config = true" + "experimental-features = nix-command flakes" + "substituters = https://cache.nixos.org" + "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + }) + ]; + extraCommands = builtins.concatStringsSep "\n" [ + # /usr/bin/env + "mkdir usr" + "ln -s ../bin usr/bin" + # create /tmp + "mkdir -m 1777 tmp" + # root needs a home + "mkdir -vp root" + ]; + config = { + Cmd = [ "/bin/bash" ]; + Env = [ + "LANG=en_GB.UTF-8" + "ENV=/etc/profile.d/nix.sh" + "BASH_ENV=/etc/profile.d/nix.sh" + "NIX_BUILD_SHELL=/bin/bash" + "NIX_PATH=nixpkgs=${./fake_nixpkgs}" + "PAGER=cat" + "PATH=/usr/bin:/bin" + "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" + "USER=root" + ]; + }; + }; + in + { + packages = { + nixos-2411 = containerLambda "nixos" "24.11" nixpkgs; + nixos-unstable = containerLambda "nixos" "unstable" nixpkgs-unstable; + }; + } + ); +} -- 2.47.2 From f9ad10d811fe8b88436d3ea98b2149dd90f57cb4 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 15:27:53 +0100 Subject: [PATCH 03/30] Actions: Add build action --- .forgejo/workflows/publish.yaml | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .forgejo/workflows/publish.yaml diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml new file mode 100644 index 0000000..28e1eca --- /dev/null +++ b/.forgejo/workflows/publish.yaml @@ -0,0 +1,37 @@ +name: build and publish containers + +on: + push: + branches: + - main + schedule: + - cron: "0 0 * * 1,3,5" + workflow_dispatch: {} + +jobs: + build: + runs-on: nixos-latest + strategy: &strategy + matrix: + container: [ nixos ] + version: [ "24.11", "unstable" ] + steps: + - name: pre-requisites + run: | + nix-env -iA nixpkgs.docker nixpkgs.nodejs_20 nixpkgs.gnused nixpkgs.coreutils && mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf + - name: checkout + uses: actions/checkout@v4 + with: + ref: 'main' + - name: nix package names + id: pkgs + run: | + echo "pkgs-name=${{ matrix.container }}-${{ matrix.version }}" | tr -d . >>"${GITHUB_OUTPUT}"" + - name: build + uses: actions/nix/build@main + with: + package: ${{ steps.pkgs.outputs.pkgs-name }} + out-link: ${{ steps.pkgs.outputs.pkgs-name }} + - name: load image into docker + run: | + docker load < ${{ steps.pkg.outputs.pkg-name }} -- 2.47.2 From f337d7e8c1fe6f7ce3bcf8013be26d1a67204c91 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 15:37:16 +0100 Subject: [PATCH 04/30] fix: use full path for nix action for now --- .forgejo/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 28e1eca..8234815 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -28,7 +28,7 @@ jobs: run: | echo "pkgs-name=${{ matrix.container }}-${{ matrix.version }}" | tr -d . >>"${GITHUB_OUTPUT}"" - name: build - uses: actions/nix/build@main + uses: git.flyinggecko.org/actions/nix/build@main with: package: ${{ steps.pkgs.outputs.pkgs-name }} out-link: ${{ steps.pkgs.outputs.pkgs-name }} -- 2.47.2 From d3ac56c8c47546396438eb2cc5eeb02734181073 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 15:40:08 +0100 Subject: [PATCH 05/30] Actions: don't run publish manually --- .forgejo/workflows/publish.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 8234815..bd1ab99 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -6,7 +6,6 @@ on: - main schedule: - cron: "0 0 * * 1,3,5" - workflow_dispatch: {} jobs: build: -- 2.47.2 From 513615c6ebf2c7f07ec5ad7a5c0223f82ca6d02c Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 15:40:27 +0100 Subject: [PATCH 06/30] Actions: Add flake update action --- .forgejo/workflows/update.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .forgejo/workflows/update.yaml diff --git a/.forgejo/workflows/update.yaml b/.forgejo/workflows/update.yaml new file mode 100644 index 0000000..16596aa --- /dev/null +++ b/.forgejo/workflows/update.yaml @@ -0,0 +1,19 @@ +name: scheduled flake.lock update +on: + schedule: + - cron: "0 0 * * 0,2,4" + workflow_dispatch: {} + +jobs: + flake-lock-update: + runs-on: nixos-latest + steps: + - run: nix-env -iA nixpkgs.nodejs_20 nixpkgs.gnused nixpkgs.coreutils + - run: mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf + - uses: actions/checkout@v4 + with: + ref: 'main' + - uses: actions/nix-flake-update-pr.git@main + with: + token: ${{ secrets.FORGEJO_PR_TOKEN }} + author-email: flake@flyinggecko.org -- 2.47.2 From cfa9fcad70a3b9f4976eeb11f2deb037b9edd9a2 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 16:03:46 +0100 Subject: [PATCH 07/30] Actions: fixup action location --- .forgejo/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index bd1ab99..8d36b68 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -27,7 +27,7 @@ jobs: run: | echo "pkgs-name=${{ matrix.container }}-${{ matrix.version }}" | tr -d . >>"${GITHUB_OUTPUT}"" - name: build - uses: git.flyinggecko.org/actions/nix/build@main + uses: actions/nix/build@main with: package: ${{ steps.pkgs.outputs.pkgs-name }} out-link: ${{ steps.pkgs.outputs.pkgs-name }} -- 2.47.2 From 6ce89c3c2d8543001a62b6c0c1f25d8d037f9def Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 16:04:55 +0100 Subject: [PATCH 08/30] Actions: fixup " to much --- .forgejo/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 8d36b68..e2869a4 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -25,7 +25,7 @@ jobs: - name: nix package names id: pkgs run: | - echo "pkgs-name=${{ matrix.container }}-${{ matrix.version }}" | tr -d . >>"${GITHUB_OUTPUT}"" + echo "pkgs-name=${{ matrix.container }}-${{ matrix.version }}" | tr -d . >>"${GITHUB_OUTPUT}" - name: build uses: actions/nix/build@main with: -- 2.47.2 From f046eb6555ecc952a9c37fb3593a4685a2b8f639 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 16:11:28 +0100 Subject: [PATCH 09/30] Actions: publish - fixup --- .forgejo/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index e2869a4..82bf272 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -33,4 +33,4 @@ jobs: out-link: ${{ steps.pkgs.outputs.pkgs-name }} - name: load image into docker run: | - docker load < ${{ steps.pkg.outputs.pkg-name }} + docker load < ${{ steps.pkgs.outputs.pkgs-name }} -- 2.47.2 From feed48538c32be2a1ce71529a952e16d9c9f9756 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 16:25:52 +0100 Subject: [PATCH 10/30] Actions: try podman for publishing --- .forgejo/workflows/publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 82bf272..52d7d8f 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -17,7 +17,7 @@ jobs: steps: - name: pre-requisites run: | - nix-env -iA nixpkgs.docker nixpkgs.nodejs_20 nixpkgs.gnused nixpkgs.coreutils && mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf + nix-env -iA nixpkgs.docker nixpkgs.podman nixpkgs.nodejs_20 nixpkgs.gnused nixpkgs.coreutils && mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf - name: checkout uses: actions/checkout@v4 with: @@ -33,4 +33,4 @@ jobs: out-link: ${{ steps.pkgs.outputs.pkgs-name }} - name: load image into docker run: | - docker load < ${{ steps.pkgs.outputs.pkgs-name }} + podman load < ${{ steps.pkgs.outputs.pkgs-name }} -- 2.47.2 From 0f169c086772dcc67a819497bee3ae153edbd944 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 22:58:51 +0100 Subject: [PATCH 11/30] Actions: try podman remote --- .forgejo/workflows/publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 52d7d8f..4c3aca4 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -31,6 +31,6 @@ jobs: with: package: ${{ steps.pkgs.outputs.pkgs-name }} out-link: ${{ steps.pkgs.outputs.pkgs-name }} - - name: load image into docker + - name: load image into podman run: | - podman load < ${{ steps.pkgs.outputs.pkgs-name }} + podman --remote load < ${{ steps.pkgs.outputs.pkgs-name }} -- 2.47.2 From b7740c93f833fc78af1a25bd2141115cef1d3789 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 22:59:54 +0100 Subject: [PATCH 12/30] nixos-runner - add podman to packages --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index b24d933..5d0ffba 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ coreutils curl docker + podman findutils gawk gitFull -- 2.47.2 From 40e78783f9626d059e49e3ebebf5cd1995fdfbd9 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Thu, 6 Feb 2025 23:13:55 +0100 Subject: [PATCH 13/30] Actions: podman without remote flag --- .forgejo/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 4c3aca4..9fa5922 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -33,4 +33,4 @@ jobs: out-link: ${{ steps.pkgs.outputs.pkgs-name }} - name: load image into podman run: | - podman --remote load < ${{ steps.pkgs.outputs.pkgs-name }} + podman load < ${{ steps.pkgs.outputs.pkgs-name }} -- 2.47.2 From 2c9c35729d9be20353b2949a881cb590f1863bad Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 7 Feb 2025 00:02:05 +0100 Subject: [PATCH 14/30] Add renovate.json --- renovate.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..3d85785 --- /dev/null +++ b/renovate.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ], + "nix": { + "enabled": true + } +} -- 2.47.2 From 1332534734cf1a6ee31a647219ab65e95f910ae4 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Fri, 7 Feb 2025 13:28:35 +0100 Subject: [PATCH 15/30] Container: add containers/policy.json --- flake.nix | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 5d0ffba..33d4139 100644 --- a/flake.nix +++ b/flake.nix @@ -60,7 +60,29 @@ with pkgs; (imagePackages pkgs) ++ [ - (pkgs.writeTextFile { + + (writeTextFile { + name = "containerPolicy"; + destination = "/etc/containers/policy.json"; + text = '' + { + "default": [ + { + "type": "insecureAcceptAnything" + } + ], + "transports": + { + "docker-daemon": + { + "": [{"type":"insecureAcceptAnything"}] + } + } + } + ''; + }) + + (writeTextFile { name = "passwd"; destination = "/etc/passwd"; text = builtins.concatStringsSep "\n" [ @@ -100,7 +122,8 @@ "nobody:x:65534:65534:Unprivileged account (don't use!):/var/empty:/run/current-system/sw/bin/nologin" ]; }) - (pkgs.writeTextFile { + + (writeTextFile { name = "group"; destination = "/etc/group"; text = builtins.concatStringsSep "\n" [ @@ -127,7 +150,8 @@ "nogroup:x:65534:" ]; }) - (pkgs.writeTextFile { + + (writeTextFile { name = "nsswitch.conf"; destination = "/etc/nsswitch.conf"; text = builtins.concatStringsSep "\n" [ @@ -142,7 +166,8 @@ "rpc: files" ]; }) - (pkgs.writeTextFile { + + (writeTextFile { name = "nix.conf"; destination = "/etc/nix/nix.conf"; text = builtins.concatStringsSep "\n" [ @@ -153,6 +178,7 @@ ]; }) ]; + extraCommands = builtins.concatStringsSep "\n" [ # /usr/bin/env "mkdir usr" @@ -162,6 +188,7 @@ # root needs a home "mkdir -vp root" ]; + config = { Cmd = [ "/bin/bash" ]; Env = [ -- 2.47.2 From 775153a7a30caab641a355a8bf13531430291eec Mon Sep 17 00:00:00 2001 From: forgejo-actions Date: Sun, 9 Feb 2025 00:02:57 +0000 Subject: [PATCH 16/30] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: ``` • Updated input 'nixpkgs': 'github:nixos/nixpkgs/030ba1976b7c0e1a67d9716b17308ccdab5b381e?narHash=sha256-nJj8f78AYAxl/zqLiFGXn5Im1qjFKU8yBPKoWEeZN5M%3D' (2025-02-04) → 'github:nixos/nixpkgs/f5a32fa27df91dfc4b762671a0e0a859a8a0058f?narHash=sha256-7x%2BQ4xgFj9UxZZO9aUDCR8h4vyYut4zPUvfj3i%2BjBHE%3D' (2025-02-06) • Updated input 'nixpkgs-unstable': 'github:nixos/nixpkgs/799ba5bffed04ced7067a91798353d360788b30d?narHash=sha256-ooLh%2BXW8jfa%2B91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U%3D' (2025-02-04) → 'github:nixos/nixpkgs/a79cfe0ebd24952b580b1cf08cd906354996d547?narHash=sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y%3D' (2025-02-08) ``` --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 3c5952f..98d43f1 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1738702386, - "narHash": "sha256-nJj8f78AYAxl/zqLiFGXn5Im1qjFKU8yBPKoWEeZN5M=", + "lastModified": 1738843498, + "narHash": "sha256-7x+Q4xgFj9UxZZO9aUDCR8h4vyYut4zPUvfj3i+jBHE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "030ba1976b7c0e1a67d9716b17308ccdab5b381e", + "rev": "f5a32fa27df91dfc4b762671a0e0a859a8a0058f", "type": "github" }, "original": { @@ -36,11 +36,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1738680400, - "narHash": "sha256-ooLh+XW8jfa+91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U=", + "lastModified": 1739020877, + "narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=", "owner": "nixos", "repo": "nixpkgs", - "rev": "799ba5bffed04ced7067a91798353d360788b30d", + "rev": "a79cfe0ebd24952b580b1cf08cd906354996d547", "type": "github" }, "original": { -- 2.47.2 From f8e7c2d0f3cdf5a772c75798ed347462609762f8 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 00:12:43 +0100 Subject: [PATCH 17/30] nixos-unstable: add container/registries.conf --- flake.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 33d4139..86240c4 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,6 @@ cacert coreutils curl - docker podman findutils gawk @@ -82,6 +81,21 @@ ''; }) + (writeTextFile { + name = "containerRegistries"; + destination = "/etc/containers/registries.conf"; + text = '' + [registries.block] + registries = [] + + [registries.insecure] + registries = [] + + [registries.search] + registries = ["docker.io", "quay.io"] + ''; + }) + (writeTextFile { name = "passwd"; destination = "/etc/passwd"; @@ -185,6 +199,8 @@ "ln -s ../bin usr/bin" # create /tmp "mkdir -m 1777 tmp" + "mkdir -m 0755 var" + "ln -s ../tmp var/tmp" # root needs a home "mkdir -vp root" ]; -- 2.47.2 From 3a2cc1d3d7991497e2b96377bcd1061bcc4f937a Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 00:41:22 +0100 Subject: [PATCH 18/30] Actions: misc * remove redundent step * add missing sed to actions image --- .forgejo/workflows/publish.yaml | 3 --- .gitignore | 1 + flake.nix | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 9fa5922..f7acffa 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -15,9 +15,6 @@ jobs: container: [ nixos ] version: [ "24.11", "unstable" ] steps: - - name: pre-requisites - run: | - nix-env -iA nixpkgs.docker nixpkgs.podman nixpkgs.nodejs_20 nixpkgs.gnused nixpkgs.coreutils && mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf - name: checkout uses: actions/checkout@v4 with: diff --git a/.gitignore b/.gitignore index a806510..809a23c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ result result-* +nixos-* diff --git a/flake.nix b/flake.nix index 86240c4..5038ab5 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,7 @@ gawk gitFull gnugrep + gnused gnutar gzip jq -- 2.47.2 From 7e3ddf74102355e04bf45988d91e85f0a9d2515e Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 00:56:26 +0100 Subject: [PATCH 19/30] Actions: Add publish job --- .forgejo/workflows/publish.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index f7acffa..450affc 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -31,3 +31,19 @@ jobs: - name: load image into podman run: | podman load < ${{ steps.pkgs.outputs.pkgs-name }} + + publish: + runs-on: nixos-latest + strategy: *strategy + steps: + - name: login to container registry + uses: https://code.forgejo.org/docker/login-action@v2 + with: + registry: git.flyinggecko.org + username: flyinggecko + password: ${{ secrets.REGISTRY_TOKEN }} + - name: publish image + env: + IMAGE: git.flyinggecko.org/flyinggecko/oci-images/${{ matrix.container }}:${{ matrix.version }} + run: | + docker push "${IMAGE}" -- 2.47.2 From fa434ee76e29452a52e30d1ba647cc0fba6d630b Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 00:59:48 +0100 Subject: [PATCH 20/30] Actions: make publish depend on build --- .forgejo/workflows/publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 450affc..218cd54 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -34,6 +34,7 @@ jobs: publish: runs-on: nixos-latest + needs: build strategy: *strategy steps: - name: login to container registry -- 2.47.2 From e6e31523fe6b3d01a8cf17c0f405645c6eda3f3c Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 21:53:52 +0100 Subject: [PATCH 21/30] Actions: Use podman actions for publishing --- .forgejo/workflows/publish.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 218cd54..4704696 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -38,13 +38,14 @@ jobs: strategy: *strategy steps: - name: login to container registry - uses: https://code.forgejo.org/docker/login-action@v2 + uses: redhat-actions/podman-login@v1 with: registry: git.flyinggecko.org username: flyinggecko password: ${{ secrets.REGISTRY_TOKEN }} - name: publish image - env: - IMAGE: git.flyinggecko.org/flyinggecko/oci-images/${{ matrix.container }}:${{ matrix.version }} - run: | - docker push "${IMAGE}" + uses: redhat-actions/push-to-registry@v2 + with: + image: git.flyinggecko.org/flyinggecko/oci-images/${{ matrix.container }} + tags: ${{ matrix.version }} + registry: git.flyinggecko.org -- 2.47.2 From 676496994c5842c8663231e02c99a2ff884bdb96 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 22:05:32 +0100 Subject: [PATCH 22/30] Actions: fix podman actions path --- .forgejo/workflows/publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 4704696..72c45a8 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -38,13 +38,13 @@ jobs: strategy: *strategy steps: - name: login to container registry - uses: redhat-actions/podman-login@v1 + uses: actions/podman-login@v1 with: registry: git.flyinggecko.org username: flyinggecko password: ${{ secrets.REGISTRY_TOKEN }} - name: publish image - uses: redhat-actions/push-to-registry@v2 + uses: actions/push-to-registry@v2 with: image: git.flyinggecko.org/flyinggecko/oci-images/${{ matrix.container }} tags: ${{ matrix.version }} -- 2.47.2 From 02cc15954bec437b0e14a68d931ac92c54ff97da Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 22:15:15 +0100 Subject: [PATCH 23/30] Actions: make publish just 1 job --- .forgejo/workflows/publish.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 72c45a8..e2b7a8a 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -10,7 +10,7 @@ on: jobs: build: runs-on: nixos-latest - strategy: &strategy + strategy: matrix: container: [ nixos ] version: [ "24.11", "unstable" ] @@ -31,12 +31,6 @@ jobs: - name: load image into podman run: | podman load < ${{ steps.pkgs.outputs.pkgs-name }} - - publish: - runs-on: nixos-latest - needs: build - strategy: *strategy - steps: - name: login to container registry uses: actions/podman-login@v1 with: -- 2.47.2 From 4e27b1ecdc0344f5aa70a568543b1a3e53e2d195 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 22:24:46 +0100 Subject: [PATCH 24/30] Actions: login and push in one step --- .forgejo/workflows/publish.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index e2b7a8a..fe78d49 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -31,15 +31,11 @@ jobs: - name: load image into podman run: | podman load < ${{ steps.pkgs.outputs.pkgs-name }} - - name: login to container registry - uses: actions/podman-login@v1 - with: - registry: git.flyinggecko.org - username: flyinggecko - password: ${{ secrets.REGISTRY_TOKEN }} - name: publish image uses: actions/push-to-registry@v2 with: image: git.flyinggecko.org/flyinggecko/oci-images/${{ matrix.container }} tags: ${{ matrix.version }} registry: git.flyinggecko.org + username: flyinggecko + password: ${{ secrets.REGISTRY_TOKEN } -- 2.47.2 From 5acc5d351d3981e40a3e4790ef6d164f34463d42 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 22:34:34 +0100 Subject: [PATCH 25/30] Actions: fix publish job --- .forgejo/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index fe78d49..697ed06 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -34,7 +34,7 @@ jobs: - name: publish image uses: actions/push-to-registry@v2 with: - image: git.flyinggecko.org/flyinggecko/oci-images/${{ matrix.container }} + image: oci-images/${{ matrix.container }} tags: ${{ matrix.version }} registry: git.flyinggecko.org username: flyinggecko -- 2.47.2 From 0d19bae865c903104295a3e04b495513a11809e1 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 22:42:01 +0100 Subject: [PATCH 26/30] Actions: fixup image path again --- .forgejo/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 697ed06..31f6a04 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -34,7 +34,7 @@ jobs: - name: publish image uses: actions/push-to-registry@v2 with: - image: oci-images/${{ matrix.container }} + image: oci-images/nixos-runner/${{ matrix.container }} tags: ${{ matrix.version }} registry: git.flyinggecko.org username: flyinggecko -- 2.47.2 From 74177692bef4b85532f168c11ba09fb58b9104c0 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 22:48:35 +0100 Subject: [PATCH 27/30] Actions: fixup publish --- .forgejo/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 31f6a04..7722509 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -38,4 +38,4 @@ jobs: tags: ${{ matrix.version }} registry: git.flyinggecko.org username: flyinggecko - password: ${{ secrets.REGISTRY_TOKEN } + password: ${{ secrets.REGISTRY_TOKEN }} -- 2.47.2 From d014572b7a2bf118e7d3cea8570af0eaeebc8608 Mon Sep 17 00:00:00 2001 From: Julian Stiller Date: Tue, 11 Feb 2025 22:48:48 +0100 Subject: [PATCH 28/30] Actions: simplify update action --- .forgejo/workflows/update.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.forgejo/workflows/update.yaml b/.forgejo/workflows/update.yaml index 16596aa..b37e5aa 100644 --- a/.forgejo/workflows/update.yaml +++ b/.forgejo/workflows/update.yaml @@ -8,8 +8,6 @@ jobs: flake-lock-update: runs-on: nixos-latest steps: - - run: nix-env -iA nixpkgs.nodejs_20 nixpkgs.gnused nixpkgs.coreutils - - run: mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf - uses: actions/checkout@v4 with: ref: 'main' -- 2.47.2 From 2957ae1e35c659b2186455d30632682fd72e826b Mon Sep 17 00:00:00 2001 From: flyinggecko Date: Tue, 11 Feb 2025 22:59:01 +0000 Subject: [PATCH 29/30] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: ``` • Updated input 'nixpkgs': 'github:nixos/nixpkgs/f5a32fa27df91dfc4b762671a0e0a859a8a0058f' (2025-02-06) → 'github:nixos/nixpkgs/44534bc021b85c8d78e465021e21f33b856e2540' (2025-02-10) ``` --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 98d43f1..362ff3b 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1738843498, - "narHash": "sha256-7x+Q4xgFj9UxZZO9aUDCR8h4vyYut4zPUvfj3i+jBHE=", + "lastModified": 1739206421, + "narHash": "sha256-PwQASeL2cGVmrtQYlrBur0U20Xy07uSWVnFup2PHnDs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f5a32fa27df91dfc4b762671a0e0a859a8a0058f", + "rev": "44534bc021b85c8d78e465021e21f33b856e2540", "type": "github" }, "original": { -- 2.47.2 From 11a64f4fb4ef2b3a29d1c44663b633d63202b1e2 Mon Sep 17 00:00:00 2001 From: flyinggecko Date: Wed, 12 Feb 2025 00:03:44 +0100 Subject: [PATCH 30/30] Merge pull request 'flake.lock: Update' (#6) from flyinggecko/nix-flake-update/patch into main Reviewed-on: https://git.flyinggecko.org/oci-images/nixos-runner/pulls/6 ``` ``` --- .forgejo/workflows/publish.yaml | 41 ++++++ .forgejo/workflows/update.yaml | 17 +++ .gitignore | 6 + LICENSE | 117 ++++++++++++++++ README.md | 2 + fake_nixpkgs/default.nix | 10 ++ flake.lock | 78 +++++++++++ flake.nix | 232 ++++++++++++++++++++++++++++++++ renovate.json | 9 ++ 9 files changed, 512 insertions(+) create mode 100644 .forgejo/workflows/publish.yaml create mode 100644 .forgejo/workflows/update.yaml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 fake_nixpkgs/default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 renovate.json diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml new file mode 100644 index 0000000..7722509 --- /dev/null +++ b/.forgejo/workflows/publish.yaml @@ -0,0 +1,41 @@ +name: build and publish containers + +on: + push: + branches: + - main + schedule: + - cron: "0 0 * * 1,3,5" + +jobs: + build: + runs-on: nixos-latest + strategy: + matrix: + container: [ nixos ] + version: [ "24.11", "unstable" ] + steps: + - name: checkout + uses: actions/checkout@v4 + with: + ref: 'main' + - name: nix package names + id: pkgs + run: | + echo "pkgs-name=${{ matrix.container }}-${{ matrix.version }}" | tr -d . >>"${GITHUB_OUTPUT}" + - name: build + uses: actions/nix/build@main + with: + package: ${{ steps.pkgs.outputs.pkgs-name }} + out-link: ${{ steps.pkgs.outputs.pkgs-name }} + - name: load image into podman + run: | + podman load < ${{ steps.pkgs.outputs.pkgs-name }} + - name: publish image + uses: actions/push-to-registry@v2 + with: + image: oci-images/nixos-runner/${{ matrix.container }} + tags: ${{ matrix.version }} + registry: git.flyinggecko.org + username: flyinggecko + password: ${{ secrets.REGISTRY_TOKEN }} diff --git a/.forgejo/workflows/update.yaml b/.forgejo/workflows/update.yaml new file mode 100644 index 0000000..b37e5aa --- /dev/null +++ b/.forgejo/workflows/update.yaml @@ -0,0 +1,17 @@ +name: scheduled flake.lock update +on: + schedule: + - cron: "0 0 * * 0,2,4" + workflow_dispatch: {} + +jobs: + flake-lock-update: + runs-on: nixos-latest + steps: + - uses: actions/checkout@v4 + with: + ref: 'main' + - uses: actions/nix-flake-update-pr.git@main + with: + token: ${{ secrets.FORGEJO_PR_TOKEN }} + author-email: flake@flyinggecko.org diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..809a23c --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# ---> Nix +# Ignore build outputs from performing a nix-build or `nix build` command +result +result-* + +nixos-* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..17cb286 --- /dev/null +++ b/LICENSE @@ -0,0 +1,117 @@ +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + +signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice diff --git a/README.md b/README.md new file mode 100644 index 0000000..43ee3ab --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# nixos-runner + diff --git a/fake_nixpkgs/default.nix b/fake_nixpkgs/default.nix new file mode 100644 index 0000000..3001f60 --- /dev/null +++ b/fake_nixpkgs/default.nix @@ -0,0 +1,10 @@ +_: +throw '' + This container doesn't include nixpkgs. + + The best way to work around that is to pin your dependencies. See + https://nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs.html + + Or if you must, override the NIX_PATH environment variable with eg: + "NIX_PATH=nixpkgs=channel:nixos-unstable" +'' diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..362ff3b --- /dev/null +++ b/flake.lock @@ -0,0 +1,78 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739206421, + "narHash": "sha256-PwQASeL2cGVmrtQYlrBur0U20Xy07uSWVnFup2PHnDs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "44534bc021b85c8d78e465021e21f33b856e2540", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1739020877, + "narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a79cfe0ebd24952b580b1cf08cd906354996d547", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5038ab5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,232 @@ +{ + description = "Nix-based oci images for actions"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + nixpkgs-unstable, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + inherit (nixpkgs) lib; + imagePackages = + pkgs: with pkgs; [ + bashInteractive + cacert + coreutils + curl + podman + findutils + gawk + gitFull + gnugrep + gnused + gnutar + gzip + jq + nodejs + openssl + openssh + rsync + sudo + wget + xz + makeWrapper + bats + shellcheck + reuse + lix + sops + nvd + ]; + containerLambda = + name: tag: pkgs': + let + pkgs = import pkgs' { inherit system; }; + in + pkgs.dockerTools.buildImageWithNixDb { + name = "git.flyinggecko.org/oci-images/nixos-runner/${name}"; + tag = tag; + copyToRoot = + with pkgs; + (imagePackages pkgs) + ++ [ + + (writeTextFile { + name = "containerPolicy"; + destination = "/etc/containers/policy.json"; + text = '' + { + "default": [ + { + "type": "insecureAcceptAnything" + } + ], + "transports": + { + "docker-daemon": + { + "": [{"type":"insecureAcceptAnything"}] + } + } + } + ''; + }) + + (writeTextFile { + name = "containerRegistries"; + destination = "/etc/containers/registries.conf"; + text = '' + [registries.block] + registries = [] + + [registries.insecure] + registries = [] + + [registries.search] + registries = ["docker.io", "quay.io"] + ''; + }) + + (writeTextFile { + name = "passwd"; + destination = "/etc/passwd"; + text = builtins.concatStringsSep "\n" [ + "root:x:0:0:System administrator:/root:/bin/bash" + "nixbld1:x:30001:30000:Nix build user 1:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld2:x:30002:30000:Nix build user 2:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld3:x:30003:30000:Nix build user 3:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld4:x:30004:30000:Nix build user 4:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld5:x:30005:30000:Nix build user 5:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld6:x:30006:30000:Nix build user 6:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld7:x:30007:30000:Nix build user 7:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld8:x:30008:30000:Nix build user 8:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld9:x:30009:30000:Nix build user 9:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld10:x:30010:30000:Nix build user 10:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld11:x:30011:30000:Nix build user 11:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld12:x:30012:30000:Nix build user 12:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld13:x:30013:30000:Nix build user 13:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld14:x:30014:30000:Nix build user 14:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld15:x:30015:30000:Nix build user 15:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld16:x:30016:30000:Nix build user 16:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld17:x:30017:30000:Nix build user 17:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld18:x:30018:30000:Nix build user 18:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld19:x:30019:30000:Nix build user 19:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld20:x:30020:30000:Nix build user 20:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld21:x:30021:30000:Nix build user 21:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld22:x:30022:30000:Nix build user 22:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld23:x:30023:30000:Nix build user 23:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld24:x:30024:30000:Nix build user 24:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld25:x:30025:30000:Nix build user 25:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld26:x:30026:30000:Nix build user 26:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld27:x:30027:30000:Nix build user 27:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld28:x:30028:30000:Nix build user 28:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld29:x:30029:30000:Nix build user 29:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld30:x:30030:30000:Nix build user 30:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld31:x:30031:30000:Nix build user 31:/var/empty:/run/current-system/sw/bin/nologin" + "nixbld32:x:30032:30000:Nix build user 32:/var/empty:/run/current-system/sw/bin/nologin" + "nobody:x:65534:65534:Unprivileged account (don't use!):/var/empty:/run/current-system/sw/bin/nologin" + ]; + }) + + (writeTextFile { + name = "group"; + destination = "/etc/group"; + text = builtins.concatStringsSep "\n" [ + "root:x:0:" + "wheel:x:1:" + "kmem:x:2:" + "tty:x:3:" + "messagebus:x:4:" + "disk:x:6:" + "audio:x:17:" + "floppy:x:18:" + "uucp:x:19:" + "lp:x:20:" + "cdrom:x:24:" + "tape:x:25:" + "video:x:26:" + "dialout:x:27:" + "utmp:x:29:" + "adm:x:55:" + "keys:x:96:" + "users:x:100:" + "input:x:174:" + "nixbld:x:30000:nixbld1,nixbld10,nixbld11,nixbld12,nixbld13,nixbld14,nixbld15,nixbld16,nixbld17,nixbld18,nixbld19,nixbld2,nixbld20,nixbld21,nixbld22,nixbld23,nixbld24,nixbld25,nixbld26,nixbld27,nixbld28,nixbld29,nixbld3,nixbld30,nixbld31,nixbld32,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9" + "nogroup:x:65534:" + ]; + }) + + (writeTextFile { + name = "nsswitch.conf"; + destination = "/etc/nsswitch.conf"; + text = builtins.concatStringsSep "\n" [ + "passwd: files mymachines systemd" + "group: files mymachines systemd" + "shadow: files" + "hosts: files mymachines dns myhostname" + "networks: files" + "ethers: files" + "services: files" + "protocols: files" + "rpc: files" + ]; + }) + + (writeTextFile { + name = "nix.conf"; + destination = "/etc/nix/nix.conf"; + text = builtins.concatStringsSep "\n" [ + "accept-flake-config = true" + "experimental-features = nix-command flakes" + "substituters = https://cache.nixos.org" + "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + }) + ]; + + extraCommands = builtins.concatStringsSep "\n" [ + # /usr/bin/env + "mkdir usr" + "ln -s ../bin usr/bin" + # create /tmp + "mkdir -m 1777 tmp" + "mkdir -m 0755 var" + "ln -s ../tmp var/tmp" + # root needs a home + "mkdir -vp root" + ]; + + config = { + Cmd = [ "/bin/bash" ]; + Env = [ + "LANG=en_GB.UTF-8" + "ENV=/etc/profile.d/nix.sh" + "BASH_ENV=/etc/profile.d/nix.sh" + "NIX_BUILD_SHELL=/bin/bash" + "NIX_PATH=nixpkgs=${./fake_nixpkgs}" + "PAGER=cat" + "PATH=/usr/bin:/bin" + "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" + "USER=root" + ]; + }; + }; + in + { + packages = { + nixos-2411 = containerLambda "nixos" "24.11" nixpkgs; + nixos-unstable = containerLambda "nixos" "unstable" nixpkgs-unstable; + }; + } + ); +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..3d85785 --- /dev/null +++ b/renovate.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ], + "nix": { + "enabled": true + } +} -- 2.47.2